A scalable FastAPI application with user authentication and OAuth integration.
Shadiejo/
├── app/ # Main application package
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication routes
│ │ └── oauth/ # OAuth routes
│ ├── core/ # Core configuration
│ │ ├── config.py # Application settings
│ │ └── database.py # Database models and connection
│ ├── schemas/ # Pydantic models
│ ├── services/ # Business logic
│ ├── utils/ # Utility functions
│ ├── main.py # FastAPI application
│ └── run.py # Application runner
├── alembic/ # Database migrations
├── templates/ # HTML templates
├── static/ # Static files
├── tests/ # Test files
├── main.py # Entry point
├── run.py # Startup script
├── requirements.txt # Dependencies
└── README.md # This file
- User Authentication: Registration, login, logout
- OAuth Integration: Google OAuth2 support
- JWT Tokens: Secure token-based authentication
- Database: PostgreSQL with SQLAlchemy ORM
- Migrations: Alembic for database schema management
- Scalable Architecture: Modular structure for easy expansion
-
Install Dependencies
pip install -r requirements.txt
-
Set Environment Variables Create a
.envfile:DATABASE_URL=postgresql://username:password@localhost/shadiejo SECRET_KEY=your-secret-key-here GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret -
Run Database Migrations
alembic upgrade head
-
Start the Application
python run.py
POST /auth/signup- User registrationPOST /auth/login- User loginGET /auth/me- Get current user infoPOST /auth/logout- User logout
GET /auth/oauth/google- Google OAuth loginGET /auth/oauth/google/callback- Google OAuth callback
GET /- Home page (login)GET /login- Login pageGET /signup- Signup pageGET /dashboard- Dashboard page
The project follows a scalable architecture:
- app/core/: Configuration and database setup
- app/api/: API route handlers organized by feature
- app/schemas/: Pydantic models for request/response validation
- app/services/: Business logic (can be added as the app grows)
- app/utils/: Utility functions and helpers
The application uses PostgreSQL with SQLAlchemy ORM. Database migrations are handled by Alembic.
Run tests with:
pytest tests/The application is ready for deployment with:
- Docker support
- Environment-based configuration
- Database migrations
- Static file serving