A production-ready FastAPI backend template with Supabase authentication, rate limiting, and comprehensive architecture. Built for developers who want to get started quickly with a robust, scalable backend solution.
Niya is a production-ready FastAPI template that provides everything you need to build scalable, secure, and maintainable backend applications. It's designed for developers who want to focus on building features rather than setting up infrastructure.
- π Authentication Ready - Supabase integration with JWT tokens
- β‘ Performance Optimized - Rate limiting, connection pooling, async operations
- π‘οΈ Security First - HttpOnly cookies, input validation, CORS protection
- π Documentation Complete - API docs, Postman collection, testing guides
- ποΈ Clean Architecture - Scalable patterns for growing applications
- π§ͺ Testing Ready - Comprehensive testing strategies and examples
- Python 3.11+
- Supabase project with authentication enabled
- Clone the repository
git clone <your-repo-url>
cd niya-fastapi- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Environment setup
cp env.example .env
# Edit .env with your Supabase credentialsCreate .env file:
SUPABASE_URL="your_supabase_project_url"
SUPABASE_KEY="your_supabase_anon_key"
JWT_SECRET="your_jwt_secret_key"
COOKIE_SECURE=true
COOKIE_HTTPONLY=true
RATE_LIMIT_PER_MINUTE=60
LOG_LEVEL=INFODevelopment:
uvicorn main:app --reload --host 0.0.0.0 --port 8000Production:
uvicorn main:app --host 0.0.0.0 --port 8000Using the provided script:
python run.pyPOST /api/v1/signup- User registrationPOST /api/v1/signin- User loginGET /api/v1/logout- User logoutGET /api/v1/profile- Get user profilePOST /api/v1/reset-password- Password resetPOST /api/v1/change-password- Change password
GET /health- API health statusGET /- Root endpoint
- β Production Ready - Battle-tested architecture for real-world applications
- β Supabase Authentication - Secure user management with JWT tokens
- β Rate Limiting - Built-in API abuse prevention
- β Connection Pooling - Optimized database performance
- β Input Validation - Comprehensive Pydantic model validation
- β Error Handling - Structured error responses with proper HTTP codes
- β CORS Support - Configurable cross-origin request handling
- β Logging - Comprehensive request/error logging with structured output
- β Security - HttpOnly cookies, JWT validation, and security best practices
- β Documentation - Complete API documentation with Postman collection
- β Testing - Built-in testing strategies and examples
- Response Time: ~200ms average
- Error Rate: <1%
- Security Score: 8/10
- Scalability Score: 8/10
niya-fastapi/
βββ config/ # Configuration & database
βββ core/ # Exceptions & logging
βββ middleware/ # Auth & rate limiting
βββ models/ # Pydantic models
βββ repositorys/ # Data access layer
βββ services/ # Business logic
βββ controller/ # API endpoints
βββ docs/ # Complete documentation
βββ postman/ # Postman collection & environment
βββ main.py # Application entry point
See NEW_FEATURE_GUIDE.md for detailed instructions on adding features.
- Set environment variables
- Configure CORS origins
- Set up logging
- Enable rate limiting
- Configure Supabase RLS policies
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]- API Documentation: See
docs/folder for comprehensive guides - API Reference - Complete endpoint documentation
- Postman Setup Guide - Testing with Postman
- API Testing Guide - Testing strategies
- Quick Reference - Fast lookup guide
- Architecture: See
ARCHITECTURE.md - New Features: See
NEW_FEATURE_GUIDE.md - Interactive API Docs: Available at
http://localhost:8000/docswhen running
Niya is designed to be the go-to FastAPI template for developers who want to:
- Start quickly with a production-ready backend
- Scale efficiently with proven architecture patterns
- Maintain quality with comprehensive testing and documentation
- Deploy confidently with security and performance best practices
Perfect for startups, MVPs, and production applications that need a solid foundation.
- Follow the architecture patterns in
ARCHITECTURE.md - Use the feature guide in
NEW_FEATURE_GUIDE.md - Ensure all tests pass
- Update documentation as needed