This is a monorepo containing both the frontend and backend code for the Trabahanap Admin application.
trabahanap-admin/
├── packages/
│ ├── frontend/ # React + Vite frontend application
│ └── backend/ # Backend application (to be implemented)
- Node.js >= 18.0.0
- npm >= 9.0.0
- Clone the repository
- Install dependencies:
npm install
To run the frontend development server:
npm run dev:frontend
To build the frontend:
npm run build:frontend
The backend is a FastAPI application.
- Python >= 3.8
- Pip (Python package installer)
- MongoDB instance (running locally or accessible via URI)
-
Navigate to the backend directory:
cd packages/backend/admin_api
-
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Python dependencies:
pip install -r requirements.txt
(Note: If
requirements.txt
doesn't exist yet, you'll need to create it based on your project's dependencies, e.g.,fastapi
,uvicorn
,pymongo
,pydantic
,python-jose
,passlib
,fastapi-mail
,python-dotenv
) -
Configure Environment Variables: Create a
.env
file in thepackages/backend/admin_api
directory. This file will store your configuration settings. Do not commit this file to version control.Copy the following template into your
.env
file and replace the placeholder values with your actual credentials and settings:# MongoDB Configuration MONGO_URI="mongodb://localhost:27017,localhost:27018,localhost:27019/trabahanap-db?replicaSet=mongoReplica" MONGO_DB_NAME="trabahanap-db" # JWT Authentication SECRET_KEY="your_strong_secret_key_here_please_change_this" ALGORITHM="HS256" # Email Configuration for fastapi-mail (using Gmail as an example) MAIL_USERNAME="[email protected]" MAIL_PASSWORD="your_gmail_app_password" # Use an App Password if 2-Step Verification is enabled MAIL_FROM="[email protected]" MAIL_PORT=587 MAIL_SERVER="smtp.gmail.com" MAIL_STARTTLS=True MAIL_SSL_TLS=False MAIL_USE_CREDENTIALS=True MAIL_VALIDATE_CERTS=True
Important Notes for
.env
:MONGO_URI
: Your MongoDB connection string.MONGO_DB_NAME
: The name of your MongoDB database.SECRET_KEY
: A strong, unique secret key for JWT token generation. Change the default value.ALGORITHM
: The algorithm used for JWT, typically HS256.MAIL_USERNAME
: Your email address for sending notifications.MAIL_PASSWORD
: Your email account password or an app-specific password (recommended for services like Gmail if 2-Step Verification is enabled).MAIL_FROM
: The email address that will appear as the sender.MAIL_PORT
: SMTP port (e.g., 587 for TLS, 465 for SSL).MAIL_SERVER
: SMTP server address (e.g.,smtp.gmail.com
).MAIL_STARTTLS
,MAIL_SSL_TLS
,MAIL_USE_CREDENTIALS
,MAIL_VALIDATE_CERTS
: Settings for your email server connection.
Once the setup is complete, you can run the backend server (typically using Uvicorn):
npm run dev:backend
(This assumes you have a script dev:backend
in your root package.json
like "dev:backend": "cd packages/backend/admin_api && uvicorn main:app --reload"
. Adjust as necessary or run Uvicorn directly from the packages/backend/admin_api
directory: uvicorn main:app --reload
)
npm run dev:frontend
- Start the frontend development servernpm run build:frontend
- Build the frontend applicationnpm run test:frontend
- Run frontend testsfastapi dev main.py
- Start the backend development server
npm run dev
- Start the development servernpm run build
- Build the applicationnpm run lint
- Run ESLintnpm run preview
- Preview the production build
[Your License Here]