Backend aplikasi Jawara menggunakan FastAPI untuk mendukung sistem manajemen perumahan/kompleks.
- Python 3.8+
- PostgreSQL/MySQL (sesuai database yang digunakan)
- Redis (opsional, untuk rate limiting)
git clone <repository-url>
cd backend_jawarapython -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activatepip install -r requirements.txtBuat file .env di root project:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/jawara_db
# JWT Secret
SECRET_KEY=your-secret-key-here
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
# Redis (Optional)
REDIS_URL=redis://localhost:6379
# Storage
STORAGE_PATH=./storage# Jalankan migrasi database
alembic upgrade head
# Jalankan seeder untuk initial data
python -m src.database.seederSetelah menjalankan seeder, berikut adalah akun default yang tersedia:
| Password | Role | |
|---|---|---|
| admin@jawara.com | password123 | Admin |
| rw@jawara.com | password123 | RW |
| rt@jawara.com | password123 | RT |
| secretary@jawara.com | password123 | Secretary |
| treasurer@jawara.com | password123 | Treasurer |
| citizen@jawara.com | password123 | Citizen |
| citizen2@jawara.com | password123 | Citizen |
mkdir -p storage/profile storage/ktpuvicorn src.main:app --reload --host 0.0.0.0 --port 8000uvicorn src.main:app --host 0.0.0.0 --port 8000 --workers 4Setelah aplikasi berjalan, akses:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
POST /auth/register- Registrasi user baruPOST /auth/login- Login userPOST /auth/refresh- Refresh access tokenPOST /auth/logout- Logout user
GET /residents- List semua residentsGET /residents/{id}- Detail residentPOST /residents- Create resident baruPUT /residents/{id}- Update residentDELETE /residents/{id}- Delete resident
GET /finance- List transaksi keuanganPOST /finance- Create transaksi baruGET /finance/reports- Generate laporan keuangan
GET /marketplace/products- List produkPOST /marketplace/products- Create produk baruGET /marketplace/banners- List banner marketplace
POST /letter/request- Request suratGET /letter/history- Riwayat permintaan suratGET /letter/{id}- Detail surat
POST /ai/predict- AI prediction endpoint- AI endpoints untuk fitur machine learning
GET /files/{file_path}- Serve file (KTP, profile, dll)
- Framework: FastAPI
- ORM: SQLAlchemy
- Validation: Pydantic
- Database: PostgreSQL/MySQL
- Caching: Redis
- Logging: Loguru
- Authentication: JWT
- Rate Limiting: FastAPI-Limiter
- JWT-based authentication
- Password hashing
- Rate limiting untuk API endpoints
- CORS configuration
- Input validation dengan Pydantic
- File path security checks
- Exception handling yang aman
# Run tests
pytest
# Run with coverage
pytest --cov=src tests/- Alex - FullStack Developer
- Ninis - ML/AI Developer
- Candra - Frontend Developer
- Ekya - FullStack Developer
Version: 1.0.0
Last Updated: December 2025