Skip to content

Isgotkowitz/litestar-realworld

Repository files navigation

RealWorld Example App

Litestar codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase demonstrates a fully fledged backend application built with Litestar including CRUD operations, authentication, routing, pagination, and more.

For more information on how this works with other frontends/backends, head over to the RealWorld repo.

How it works

Stack:

  • Litestar - ASGI framework for routing and server
  • msgspec - Fast serialization for request/response schemas
  • SQLAlchemy - ORM with PostgreSQL
  • pytest - Testing framework
  • ruff - Linting and formatting
  • ty - Type checking

Project structure:

Conduit/
├── auth/       # Authentication logic
├── db/         # Database models and configuration
├── routes/     # API endpoints
├── schemas/    # Request/response schemas
├── exception_handlers.py  # Exception handlers
├── main.py     # Server startup logic
└── settings.py # Auth, server, and database settings

The test suite covers unhappy paths for each endpoint. Happy path testing uses the official RealWorld Postman collection.

Getting started

Prerequisites: Docker and Make

  1. Set up environment variables:
   cp .env.example .env
  1. Run tests:
   make test
  1. Start the server:
   make up
  1. Verify it's running:
   make logs

The API will be available at http://localhost:8000 (or check your .env for the configured port).

About

Medium.com clone built to the Realworld specification with the Litestar ASGI framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors