FastAPI Full Template bootstrap for Project IDX

  • Project IDX: A cloud-based development environment by Google that offers a browser-first workspace for coding, featuring built-in AI assistance and seamless integration with development tools
  • FastAPI Full Template: A production-ready project generator for FastAPI applications that includes user management, authentication, SQLAlchemy models, and Docker configuration out of the box

What is going on here?

  1. The FastAPI Full Template’ Copier template is executed with default answers (-l)

    copier copy -l '[https://github.com/fastapi/full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template)' my-awesome-project --trust
  2. React frontend is installed and built

    npm ci --no-audit --prefer-offline --no-progress --timing
  3. PostgreSQL database is built and started via Docker Compose

    docker compose up db prestart
  4. FastAPI backend is started

    fastapi dev app/main.py
  5. Backend tests are executed as a Smoke Test

    ./scripts/test.sh
  6. IDX’s Web Preview is started

    npm run dev

Dependencies

The project requires:

  • Python 3.x
  • FastAPI
  • Docker and Docker Compose
  • PostgreSQL

Installation

Use this repo as the template for your project

https://github.com/getmarkus/community-templates/tree/main/full-stack-fastapi-template

Project IDX Generator:

https://idx.google.com/new

Open in IDX

Configuration

By default the Copier will execute with default values:

test-fastapi-full-6064653:~/test-fastapi-full$ pipx run copier copy https://github.com/fastapi/full-stack-fastapi-template my-awesome-project --trust
🎤 The name of the project, shown to API users (in .env)
   FastAPI Project
🎤 The name of the stack used for Docker Compose labels (no spaces) (in .env)
   fastapi-project
🎤 'The secret key for the project, used for security,
stored in .env, you can generate one with:
python -c "import secrets; print(secrets.token_urlsafe(32))"'
   changethis
🎤 The email of the first superuser (in .env)
   [email protected]
🎤 The password of the first superuser (in .env)
   changethis
🎤 The SMTP server host to send emails, you can set it later in .env

🎤 The SMTP server user to send emails, you can set it later in .env

🎤 The SMTP server password to send emails, you can set it later in .env

🎤 The email account to send emails from, you can set it later in .env
   [email protected]
🎤 'The password for the PostgreSQL database, stored in .env,
you can generate one with:
python -c "import secrets; print(secrets.token_urlsafe(32))"'
   changethis
🎤 The DSN for Sentry, if you are using it, you can set it later in .env

Known Issues

Note: In order to allow the frontend to talk to the backend the backend port must be made Public. Why? Dunno.

image.png