feat: implement pydantic multi env setup and removed node based version

This commit is contained in:
Furqan-14
2026-02-05 14:30:07 +05:30
parent 2678e9548a
commit 9b41301b09
13 changed files with 90 additions and 177 deletions
+17 -15
View File
@@ -20,9 +20,10 @@ A multi-tenant SaaS backend built with FastAPI, PostgreSQL, and SQLAlchemy.
## Prerequisites
- Python 3.12+
- PostgreSQL 12+
- Python 3.10+
- PostgreSQL 12+
- Node.js (for npm scripts)
## Getting Started
@@ -44,7 +45,7 @@ python -m venv venv
```bash
pip install -r requirements.txt
npm install # For cross-env support in npm scripts
pip install -r requirements.txt
```
### 4. Environment Configuration
@@ -112,11 +113,11 @@ alembic revision --autogenerate -m "Initial schema"
#### Run Migrations
```bash
# Using npm scripts (recommended - handles APP_ENV automatically)
npm run migrate:local
npm run migrate:dev
npm run migrate:prod
npm run migrate:test
# Using manage.py (recommended - handles APP_ENV automatically)
python manage.py migrate --env local
python manage.py migrate --env development
python manage.py migrate --env production
python manage.py migrate --env testing
# Or using alembic directly
$env:APP_ENV="local" # Set environment first
@@ -148,20 +149,20 @@ After running migrations, seed the database with initial data:
```bash
# Seed super admin user
npm run seed:superadmin:local
python manage.py seed superadmin --env local
# Seed default color palettes
npm run seed:palettes:local
python manage.py seed palettes --env local
```
### 7. Run the Application
```bash
# Using npm scripts (recommended)
npm run local # Local environment
npm run dev # Development environment
npm run prod # Production environment
npm run test # Testing environment
# Using manage.py (recommended)
python manage.py run --env local # Local environment
python manage.py run --env development # Development environment
python manage.py run --env production # Production environment
python manage.py run --env testing # Testing environment
# Or using Python directly
python run.py
@@ -209,7 +210,8 @@ backend/
│ ├── seed_palettes.py
│ └── seed_superadmin.py
├── alembic.ini # Alembic configuration
├── package.json # NPM scripts
├── alembic.ini # Alembic configuration
├── manage.py # Management CLI script
├── requirements.txt # Python dependencies
└── run.py # Application entry point
```