A modern web application boilerplate using Django for the backend and Next.js for the frontend.
-
Backend (Django)
- Django REST Framework for API endpoints
- JWT Authentication
- Google OAuth2 Authentication
- PostgreSQL Database
- CORS Configuration
- Swagger/OpenAPI Documentation
- Payment Integration (Stripe & LemonSqueezy)
- Subscription Management
-
Frontend (Next.js)
- TypeScript Support
- Tailwind CSS for Styling
- React Bootstrap Components
- Protected Routes
- Authentication Flow
- Payment Screen
- Responsive Design
- Python 3.11+
- Node.js 18+
- PostgreSQL
- Stripe Account (for payments)
- LemonSqueezy Account (optional, alternative payment provider)
- Create and activate a virtual environment:
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
Edit .env
with your configuration:
# Django Settings
DEBUG=True
SECRET_KEY=your_secret_key
ALLOWED_HOSTS=localhost,127.0.0.1
# Database Settings
DATABASE_URL=postgres://user:password@localhost:5432/dbname
# Email Settings
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
# Google OAuth2 Settings
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback
# Payment Settings
PAYMENT_PROVIDER=stripe # or lemonsqueezy
# Stripe Settings
STRIPE_PUBLIC_KEY=your_stripe_public_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
# LemonSqueezy Settings
LEMON_SQUEEZY_API_KEY=your_lemonsqueezy_api_key
LEMON_SQUEEZY_WEBHOOK_SECRET=your_lemonsqueezy_webhook_secret
- Run migrations:
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
- Start the development server:
python manage.py runserver
- Install dependencies:
cd frontend
npm install
- Set up environment variables:
cp .env.example .env.local
Edit .env.local
with your configuration:
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
- Start the development server:
npm run dev
The boilerplate includes a complete payment system with the following features:
- Payment plan management
- Subscription handling
- Payment processing
- Support for multiple payment providers (Stripe & LemonSqueezy)
- Payment plan display
- Subscription management
- Protected routes based on subscription status
- Responsive payment UI
-
Stripe Setup
- Create a Stripe account
- Get your API keys from the Stripe dashboard
- Create products and prices in Stripe
- Update the
provider_price_id
in the payment plans with your Stripe price IDs
-
LemonSqueezy Setup (Optional)
- Create a LemonSqueezy account
- Get your API key from the dashboard
- Create products in LemonSqueezy
- Update the
provider_price_id
in the payment plans with your LemonSqueezy variant IDs
-
Configure Payment Provider
- Set
PAYMENT_PROVIDER=stripe
orPAYMENT_PROVIDER=lemonsqueezy
in your backend.env
file - Add the corresponding API keys and secrets
- Set
Once the backend server is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/swagger/
- ReDoc: http://localhost:8000/redoc/
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.