Skip to content

Sprint-Log/sprintlog-backend

Repository files navigation

Sprintlog: "Streamline, Collaborate, and Automate Your Team's Success, Live!"

Project Description:

Project Status
CI/CD Tests and Linting Documentation Building
Quality Coverage Quality Gate Status Maintainability Rating Reliability Rating Security Rating
Community Reddit Discord Matrix Medium Twitter Blog
Meta Litestar Project types - Mypy License - MIT Litestar Sponsors linting - Ruff code style - Black All Contributors

Litestar Fullstack Reference Application

Sprintlog is also a highly adaptable and pluggable self-hosted solution designed to optimize your team's productivity and streamline agile project management.

It contains most of the boilerplate required for a production web API with features like:

Language :

  • Python , Typescript ,Svelte,Tailwind

Framework

  • Litestar (2.0) , Sqlalchemy , Sveltekit, TanStackQuery

Repo:

Preliminary requirements tutorials for development contribution:

Backend:

Frontend

App Commands

❯ poetry run app

 Usage: app [OPTIONS] COMMAND [ARGS]...

 Litestar Reference Application

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help    Show this message and exit.                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ manage         Application Management Commands                               │
│ run            Run application services.                                     │
╰──────────────────────────────────────────────────────────────────────────────╯

Management Commands

❯ poetry run app manage

 Usage: app manage [OPTIONS] COMMAND [ARGS]...

 Application Management Commands

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help    Show this message and exit.                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ create-database                 Creates an empty postgres database and       │
│                                 executes migrations                          │
│ create-user                     Create a user                                │
│ export-openapi                  Generate an OpenAPI Schema.                  │
│ export-typescript-types         Generate TypeScript specs from the OpenAPI   │
│                                 schema.                                      │
│ generate-random-key             Admin helper to generate random character    │
│                                 string.                                      │
│ promote-to-superuser            Promotes a user to application superuser     │
│ purge-database                  Drops all tables.                            │
│ reset-database                  Executes migrations to apply any outstanding │
│                                 database structures.                         │
│ show-current-database-revision  Shows the current revision for the database. │
│ upgrade                Executes migrations to apply any outstanding │
│                                 database structures.                         │
╰──────────────────────────────────────────────────────────────────────────────╯

Run Commands

❯ poetry run app run

 Usage: app run [OPTIONS] COMMAND [ARGS]...

 Run application services.

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help    Show this message and exit.                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ server          Starts the application server                                │
│ worker          Starts the background workers                                │
╰──────────────────────────────────────────────────────────────────────────────╯

Run Commands

To run the application through Uvicorn using the standard Litestar CLI, you can use the following:

❯ poetry run app run server --help

 Usage: app run server [OPTIONS]

 Starts the application server

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --host                    Host interface to listen on.  Use 0.0.0.0 for all  │
│                           available interfaces.                              │
│                           (TEXT)                                             │
│                           [default: 0.0.0.0]                                 │
│ --port                -p  Port to bind. (INTEGER) [default: 8000]            │
│ --http-workers            The number of HTTP worker processes for handling   │
│                           requests.                                          │
│                           (INTEGER RANGE)                                    │
│                           [default: 7; 1<=x<=7]                              │
│ --worker-concurrency      The number of simultaneous jobs a worker process   │
│                           can execute.                                       │
│                           (INTEGER RANGE)                                    │
│                           [default: 10; x>=1]                                │
│ --reload              -r  Enable reload                                      │
│ --verbose             -v  Enable verbose logging.                            │
│ --debug               -d  Enable debugging.                                  │
│ --help                    Show this message and exit.                        │
╰──────────────────────────────────────────────────────────────────────────────╯

The above command will not start the background workers. Those can be launched separately in another terminal.

Alternately, the run-all command will automatically start the background workers in separate processes.

❯ poetry run app run worker --help

 Usage: app run worker [OPTIONS]

 Starts the background workers

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --worker-concurrency      The number of simultaneous jobs a worker process   │
│                           can execute.                                       │
│                           (INTEGER RANGE)                                    │
│                           [default: 1; x>=1]                                 │
│ --verbose             -v  Enable verbose logging.                            │
│ --debug               -d  Enable debugging.                                  │
│ --help                    Show this message and exit.                        │
╰──────────────────────────────────────────────────────────────────────────────╯

Installation and Configuration

Commands to help you get this repository running.

Install virtual environment and node packages

Most of the development related tasks are included in the Makefile. To install an environment with all development packages run:

make install

This command does the following:

  • install pdm if it is not available in the path.
  • create a virtual environment with all dependencies configured
  • build assets to be hosted by production asset server

Edit .env configuration

There is a sample .env file located in the root of the repository.

cp .env.example .env

Note SECRET_KEY, DATABASE_URI, and REDIS_URL are the most important config settings. Be sure to set this properly.

You can generate a SECRET_KEY by running:

❯ poetry run app manage generate-random-key
KEY: 5c5f2230767976c332b6f933b63b483a35148b2218e2cdfd0da992d859feae19

Deploy Database Migrations

You can run most of the database commands with the integrated CLI tool.

To deploy migration to the database, execute: poetry run app manage upgrade

Make Commands

Install Development Environment

This command will remove any existing environment and install a new environment with the latest dependencies.

make install

Upgrade Project Dependencies

This command will upgrade all components of the application at the same time. It automatically executes:

  • pdm upgrade
  • npm update
  • pre-commit autoupdate
make upgrade

Execute Pre-commit

This command will automatically execute the pre-commit process for the project.

make lint

Generate New Migrations

This command is a shorthand for executing app database make-migrations.

make migrations

Upgrade a Database to the Latest Revision

This command is a shorthand for executing app database upgrade.

make migrate

Execute Full Test Suite

This command executes all tests for the project.

make test