A fullstack web application with a Flask backend and a Vue.js frontend for Parking Management System.
mad2-project/ backend/ # Flask backend code frontend/ # Vue.js frontend code README.md # Project overview and instructions .gitignore
- Python 3.8+
- Node.js 16+
- Redis Server
- SQLite (included with Python)
- Mailhog (for capturing outbound emails locally)
- Location:
backend/ - Main file:
backend/app.py
-
Go to the backend folder:
cd backend -
(Recommended) Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install and start Redis:
- macOS (using Homebrew):
brew install redis brew services start redis
- Linux (Ubuntu/Debian):
sudo apt-get install redis-server sudo systemctl start redis
- Windows: Download and install Redis from https://redis.io/download Or use WSL (Windows Subsystem for Linux)
- macOS (using Homebrew):
-
(Optional) Run Mailhog so that reminder/report/export emails are captured locally:
mailhog
- SMTP input:
127.0.0.1:1025 - Web UI (where you actually read the emails): http://127.0.0.1:8025
- SMTP input:
-
Run the backend server:
python app.py
-
(Optional) Run Celery worker in a separate terminal:
cd backend source venv/bin/activate # On Windows: venv\Scripts\activate celery -A app worker --loglevel=info
-
(Optional) Run Celery beat scheduler in a separate terminal (for scheduled tasks):
cd backend source venv/bin/activate # On Windows: venv\Scripts\activate celery -A app beat --loglevel=info
- Authentication: JWT-based authentication with role-based access control (RBAC)
- Database: SQLAlchemy with SQLite
- Caching: Redis caching with expiry for frequently accessed data
- Background Jobs: Celery for scheduled and user-triggered tasks
- Monthly user tracking reports (scheduled)
- User parking details reports (user-triggered)
- Email Delivery: Mailhog-powered SMTP so daily reminders, monthly HTML reports, and CSV export alerts are visible locally
- API Endpoints: RESTful API with comprehensive CRUD operations
Default admin credentials (created automatically):
- Email:
admin@example.com - Password:
admin
- Location:
frontend/ - Main file:
frontend/src/App.vue
-
Go to the frontend folder:
cd frontend -
Install dependencies:
npm install
-
Run the development server:
npm run dev
- Framework: Vue.js 3 with Composition API
- Routing: Vue Router for navigation
- State Management: Pinia for authentication state
- HTTP Client: Axios for API calls
- Charts: Chart.js for data visualization
- UI: Modern, responsive design with gradient themes
Make sure Redis is running on localhost:6379
cd backend
source venv/bin/activate # On Windows: venv\Scripts\activate
python app.pyBackend will run on http://localhost:8080
cd frontend
npm run devFrontend will run on http://localhost:5173 (or another port if 5173 is busy)
For background job processing:
Terminal 1 - Celery Worker:
cd backend
source venv/bin/activate
celery -A app worker --loglevel=infoTerminal 2 - Celery Beat (Scheduler):
cd backend
source venv/bin/activate
celery -A app beat --loglevel=info- User registration and login
- View available parking lots
- Search parking lots by location, name, or PIN code
- Book parking spots
- View personal dashboard with statistics
- View parking analytics with charts
- Release occupied spots
- Generate parking reports (user-triggered jobs)
- Dedicated analytics/history page with tabular view
- Configure reminder & report preferences (time/channel)
- Export entire history as CSV (async job + email link)
- Admin dashboard with system overview
- Create, edit, and delete parking lots
- Manage parking spots (view, edit, delete)
- Dedicated “view all” lots page with utilization summaries
- Parking records page with global search & duration/cost stats
- View all users and their reservations
- Search functionality for users and lots
- View statistics and analytics with charts (includes earnings per lot)
- Force release occupied spots
- Daily reminders + monthly HTML reports for all users (scheduled jobs)
- Trigger on-demand admin system report (email + analytics snapshot)
- JWT token-based authentication
- Role-based access control (RBAC)
- Redis caching with expiry
- Celery for background jobs
- Scheduled tasks (monthly reports)
- User-triggered jobs (parking reports)
- RESTful API design
- Responsive UI design
- Data visualization with charts
POST /api/register- User registrationPOST /api/login- User loginPOST /api/logout- User logoutGET /api/profile- Get user profilePUT /api/profile- Update user profile
GET /api/user/dashboard- Get user dashboard dataGET /api/user/lots- Get available parking lotsPOST /api/user/lots/:lot_id/reserve- Reserve a parking spotPOST /api/user/reservations/:reservation_id/release- Release a parking spotGET /api/user/reservations/:reservation_id/confirm-release- Get release confirmation detailsPOST /api/user/generate-parking-report- Generate parking report (user-triggered job)GET /api/user/parking-report/:task_id- Get parking report statusGET/PUT /api/user/preferences- View or update reminder/report preferencesGET /api/user/history- Tabular reservation history with analyticsPOST /api/user/export-reservations- Trigger async CSV exportGET /api/user/export-reservations/:task_id- Poll CSV export statusGET /api/user/export-reservations/download/:filename- Download generated CSV
GET /api/admin/dashboard- Get admin dashboard dataGET /api/admin/users- Get all usersGET /api/admin/users/:user_id/reservations- Get user reservationsGET /api/admin/lots- Get all parking lotsPOST /api/admin/lots- Create parking lotGET /api/admin/lots/:lot_id- Get parking lot detailsPUT /api/admin/lots/:lot_id- Update parking lotDELETE /api/admin/lots/:lot_id- Delete parking lotGET /api/admin/lots/:lot_id/spots- Get parking spots for a lotGET /api/admin/spots/:spot_id- Get spot detailsPOST /api/admin/spots/:spot_id/force-release- Force release a spotDELETE /api/admin/spots/:spot_id- Delete a spotGET /api/admin/parking-records- Get all parking recordsGET /api/admin/search- Search users and lotsPOST /api/admin/reports/generate- Kick off global admin analytics emailGET /api/admin/reports/:task_id- Poll admin report task status
- Monthly User Reports: Generated automatically on the 1st of every month at midnight
- Task:
application.tasks.send_monthly_reports_to_all_users - Generates parking reports for all users
- Task:
- Daily Reminder Sweep: Runs hourly and honours each user's chosen reminder hour/channel
- Task:
application.tasks.send_daily_reminders
- Task:
- Parking Details Report: Generated when user requests it
- Task:
application.tasks.generate_user_parking_details_report - Can specify date range for the report
- Task:
- CSV Export: Generates downloadable CSV + email alert when ready
- Task:
application.tasks.generate_user_reservations_csv
- Task:
Redis caching is implemented for:
- Admin dashboard data (5 minutes expiry)
- User parking lots data (2 minutes expiry)
- Admin parking records (3 minutes expiry)
Cache is automatically cleared when:
- New parking lots are added
- Reservations are made or released
- Spots are updated
- Make sure the backend server is running before using the frontend
- Make sure Redis is running for caching and Celery to work
- Keep Mailhog running (
mailhog) to preview reminder/report/export emails at http://localhost:8025 - During demos/viva mention that SMTP traffic goes to port 1025 while the inbox lives at port 8025
- Celery workers are optional but required for background job processing
- Update the API endpoint in the frontend code if your backend runs on a different port or host
- The admin user is automatically created when the database is first initialized
- Make sure Redis is installed and running
- Check if Redis is running on
localhost:6379 - Verify Redis connection:
redis-cli ping(should returnPONG)
- Make sure Redis is running
- Check if Celery worker is running:
celery -A app worker --loglevel=info - Check if Celery beat is running for scheduled tasks:
celery -A app beat --loglevel=info
- Delete
backend/instance/database.sqlite3to reset the database - Restart the backend server to recreate the database
- Backend uses Flask with SQLAlchemy ORM
- Database models are in
backend/application/models.py - Routes are in
backend/application/routes.py - Configuration is in
backend/application/config.py
- Frontend uses Vue.js 3 with Composition API
- Components are in
frontend/src/views/ - API services are in
frontend/src/services/api.js - State management is in
frontend/src/stores/auth.js
This project is for educational purposes.