Quick Start
Get the FastAPI template running in minutes with this quick setup guide
Prerequisites
Ensure you have the following installed:
- Python 3.10+
- PostgreSQL (or use Docker)
- Redis (or use Docker)
- Git
- Docker - This guide will be using Docker
Clone the Repository
git clone https://github.com/yourusername/fastlaunchapi_template.git
cd fastlaunchapi_template/backend
Configure Environment
Copy the sample environment file:
cp .env.sample .env
Update the .env
file with basic settings:
SECRET_KEY=TEST
DATABASE_URL=postgresql://postgres:postgres@192.168.178.50:5432/template-db # change to your database url
FRONTEND_URL=http://localhost:3000 # change to your frontend url
BACKEND_URL=http://localhost:8000
GOOGLE_CLIENT_ID=<YOUR_KEY>
GOOGLE_CLIENT_SECRET=<YOUR_KEY>
GOOGLE_REDIRECT_URI=http://localhost:8000/auth/callback/google
STRIPE_PUBLIC_KEY=<YOUR_KEY>
STRIPE_SECRET_KEY=<YOUR_KEY>
WEBHOOK_SECRET=<YOUR_KEY>
OPENAI_API_KEY=<YOUR_KEY>
SENDGRID_API_KEY=<YOUR_KEY>
SUPPORT_EMAIL=support@yourcompany.com
FROM_EMAIL=noreply@yourcompany.com
COMPANY_NAME="Your Company Name"
Replace SECRET_KEY
with a secure random string.
Environment Setup
In the next step we will start all our docker containers. (postgresql, redis, celery, beat, pgadmin, redis, flower) Make sure the docker daemon is running on your machine.
# Build and start all services
docker-compose up
Install all python dependencies.
# Install dependencies
pip install -r requirements.txt
Setup Database
# Create migrations
alembic revision --autogenerate -m "Migration"
# Run migrations
alembic upgrade head
Start the Application
# Start the development server
fastapi dev
Verify Installation
Your API is now running! Check this URL:
- API Documentation: http://localhost:8000/docs
Next Steps
Now that you're up and running:
- Getting Started - Complete configuration guide
- Authentication - Set up user management
Success! Your FastAPI template is ready for development. Check out the Getting Started guide for detailed configuration and feature setup.
Troubleshooting
Database Connection Issues: Ensure PostgreSQL is running and DATABASE_URL is correct.
Port Already in Use: Change the port with --port 8001
.
Redis Connection: Make sure Redis is running on the default port 6379.