FastAPI-React-PGDB

Deploy and Host FastAPI-React-PGDB with Railway

Deploy FastAPI-React-PGDB

FRAD-template

lNamelessl/FRAD-template

Just deployed

πŸš€ FARM Stack Template

A modern, scalable template to kickstart your full-stack web projects. This template combines FastAPI (Python), React (JavaScript), and PostgresDB, all containerized with Docker and orchestrated via Docker Compose. It’s designed for rapid development and easy deployment, with a clear structure for both backend and frontend.

Inspired by best practices and scalable architecture patterns, this template helps you build robust, production-ready web applications with:

  • FastAPI for high-performance Python APIs
  • React for a modern, component-based frontend
  • PostgresDB for reliable data storage
  • Nginx for efficient static file serving and reverse proxy
  • Docker & Docker Compose for seamless local development and deployment

Whether you're building a prototype or a large-scale application, this template provides a solid foundation for your FARM stack projects.


πŸ“‘ Table of Contents

✨ Features

backend/: FastAPI backend

  • alembic/: Alembic migrations.
  • app/: Main FastAPI code.
    • sample_module/: Modular structure example
      • schemas/: Pydantic schemas
      • routes/: API routes
      • apis.py, crud.py, exceptions.py, formatters.py, models.py, selectors.py, services.py: Core logic
    • common/: Shared utilities (auth, CRUD, exceptions, pagination, schemas, security, types, utils)
    • core/: Database, handlers, settings, tags
    • external/: External integrations

frontend/: React app

  • public/: Static assets
  • src/: Components, logic, tests

nginx/: Production Nginx config

Other:

  • .vscode/: VS Code config
  • tests/: Backend tests
  • env_sample.txt: Env example
  • .flake8, .gitignore, .pylintrc: Lint/config
  • alembic.ini, docker-compose.yml, Dockerfile, LICENSE, pytest.ini, railway.toml, requirements.txt, start.sh: Project config

πŸ’‘ Getting Started

Backend (FastAPI)

  1. Create a virtual environment (if not using Docker):
    py -m venv .venv
    .venv\Scripts\activate  # Windows
    source .venv/bin/activate  # macOS/Linux
    
  2. Install dependencies:
    pip install -r requirements.txt
    
    Or use Docker Compose:
    docker compose up
    
  3. Copy .env_sample to .env and update variables.
  4. Run migrations:
    alembic upgrade head
    
  5. Start FastAPI:
    fastapi dev  # Dev
    fastapi run  # Prod
    

Frontend (React)

  1. In frontend/:
    npm install
    npm start
    
    Visit http://localhost:3000.
  2. Build for production:
    npm run build
    

Nginx

  • Use nginx/nginx.conf to serve the frontend and proxy API requests.
  • Example Docker run:
    docker run --name my-nginx -v /path/to/nginx.conf:/etc/nginx/nginx.conf:ro -v /path/to/frontend/build:/usr/share/nginx/html:ro -p 80:80 -d nginx
    

πŸš€ Deploy

Deploy on Railway:

Deploy on Railway


🀝 Contribute to the Project

We welcome contributions from the community to make this FARD Starter Template even better. If you have ideas for improvements, new features, or bug fixes, feel free to:

  • Fork the repository and create a new branch.
  • Submit a Pull Request with your changes.
  • Engage in discussions on ideas, enhancements, or fixes.

By contributing, you help make this template more valuable for developers building FastAPI applications. Together, we can create a robust foundation for large-scale projects. Thank you for your support!

For additional information, refer to the following resources:

πŸ“¬ Contact

Feel free to reach out if you have questions or suggestions.

Deploy and Host FastAPI-PGDB-Template on Railway

FastAPI-PGDB-Template is a modern, production-ready starter kit for building backend web applications. It combines FastAPI for the backend and MongoDB for data storage, all orchestrated with Docker and Docker Compose. This template is designed for rapid backend development, scalability, and easy deployment to cloud platforms like Railway.

About Hosting FastAPI-PGDB-Template

Hosting FastAPI-MongoDB-Template involves deploying a containerized backend application that integrates a high-performance FastAPI API and a robust PGDB database. With Docker Compose, all services are managed together, simplifying both local development and cloud deployment. Railway provides a seamless platform to deploy, scale, and manage your application and its dependencies, reducing operational overhead and accelerating your go-to-production timeline.

Why Deploy FastAPI-PGDB-Template on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying FastAPI-PGDB-Template on Railway, you are one step closer to supporting a complete backend application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

Common Use Cases

  • Rapid prototyping of SaaS products
  • Building scalable APIs
  • Educational projects and hackathons

Dependencies for FastAPI-PGDB-Template Hosting

  • Docker & Docker Compose
  • Railway account

Deployment Dependencies


Happy coding! πŸš€


Template Content

More templates in this category

View Template
mellow-vue
A full-stack Vue app with The Boring JavaScript Stack.

View Template
Sveltekit NestJS
Full-stack with SvelteKit + NestJS + Prisma + Postgresql with utils

View Template
.NET8 Web API
A basic ASP.NET Core Web API template (.NET 8)