A production-ready full-stack Document Management System with role-based access control.
backend/FastAPI + SQLAlchemy + JWT authfrontend/React (Vite) + React Router + Axios
- Create and activate a virtual environment.
- Install dependencies:
pip install -r requirements.txt
- Copy environment file and edit values:
cp .env.example .env
- Run migrations / create tables (automatic on startup for development).
- Start server:
uvicorn app.main:app --reload
Backend runs on http://localhost:8000.
Set DATABASE_URL in .env:
DATABASE_URL=postgresql+psycopg2://postgres:postgres@localhost:5432/document_dbFor local development with SQLite:
DATABASE_URL=sqlite:///./document_management.dbThe backend reads .env from either the repository root or backend/.env, so you can update tokens in one place without changing code.
JWT_SECRET_KEY=change-me
ACCESS_TOKEN_EXPIRE_MINUTES=60
DATABASE_URL=sqlite:///./app.db
# Use either one of these tokens
EMBEDDINGS_API_KEY=
GITHUB_TOKEN=
EMBEDDINGS_MODEL=text-embedding-3-small
EMBEDDINGS_BASE_URL=https://models.inference.ai.azure.com
SUMMARY_MODEL=gpt-4o-mini
LLM_BASE_URL=https://models.inference.ai.azure.comEMBEDDINGS_API_KEY is preferred when set; otherwise GITHUB_TOKEN is used.
- Install dependencies:
npm install
- Start dev server:
npm run dev
Frontend runs on http://localhost:5173.
Set in frontend/.env:
VITE_API_BASE_URL=http://localhost:8000/api- JWT authentication with bcrypt password hashing
- Role-based access (
admin,user) - Admin panel for user/document management
- User panel for self-managed documents
- Protected frontend routes by role
- Axios interceptor for JWT
POST /api/auth/loginGET /api/auth/meGET|POST /api/users(admin)GET|PUT /api/users/{id}(admin)GET|POST /api/documentsGET|PUT|DELETE /api/documents/{id}