Mapify is a Flask web application that combines user authentication with Mapbox-powered route visualization. Users can sign up, log in, enter a start and destination location, and view a driving route on an interactive map.
- User registration and login with encrypted passwords (
Flask-Bcrypt) - Session-based authentication and protected routes (
Flask-Login) - Route plotting between two locations using Mapbox APIs
- Interactive map rendering with
mapbox-gl-js - Persistent user storage with
Flask-SQLAlchemy
- Python
- Flask
- Flask-SQLAlchemy
- Flask-Login
- Flask-WTF / WTForms
- Flask-Bcrypt
- MySQL (via
PyMySQL) or any SQL database configured throughDATABASE_URL - Mapbox GL JS + Geocoding + Directions APIs
- Gunicorn (production server)
Mapify/
|-- main.py
|-- requirements.txt
|-- nixpacks.toml
|-- static/
| |-- css/
| `-- images/
`-- templates/
|-- index.html
|-- login.html
|-- signup.html
`-- home.html
- Python 3.9+
- A Mapbox account and access token
- A database instance (for users table)
Create a .env file (or set variables in your deployment platform):
DATABASE_URL=mysql+pymysql://username:password@host:3306/database_name
SECRET_KEY=your_strong_secret_key
MAPBOX_ACCESS_TOKEN=your_mapbox_access_token
PORT=5000Notes:
DATABASE_URLis required.SECRET_KEYshould be set explicitly in production.MAPBOX_ACCESS_TOKENis used by the app for map functionality.
# 1) Clone repository
git clone <your-repo-url>
cd Mapify
# 2) Create virtual environment
python -m venv .venv
# 3) Activate virtual environment
# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1
# macOS/Linux
source .venv/bin/activate
# 4) Install dependencies
pip install -r requirements.txtOpen a Python shell in the project root and run:
from main import app, db
with app.app_context():
db.create_all()This creates the user table defined in main.py.
python main.pyApp runs on:
http://127.0.0.1:5000- or
http://0.0.0.0:5000
Gunicorn command (already configured in nixpacks.toml):
gunicorn main:appGET /shows landing page.GET/POST /signupcreates a new user account.GET/POST /loginauthenticates user.GET/POST /home(login required) accepts start/end locations and renders route.GET /logoutlogs out the user.
- Passwords are hashed before storing.
- Keep
SECRET_KEYprivate. - Do not hardcode API tokens in templates or JavaScript for production.
- Restrict and rotate your Mapbox token periodically.
This project includes nixpacks.toml:
[build]
builder = "nixpacks"
[start]
cmd = "gunicorn main:app"It can be deployed to platforms that support Nixpacks/Gunicorn (for example: Railway).
- Flash messages for login/signup errors
- Better form validation feedback in UI
- CSRF and security hardening review
- Route profile options (driving/walking/cycling)
- Unit and integration tests
Recommended folder: docs/images/
Rohit Jain (B.Tech CSE) LinkedIn: https://www.linkedin.com/in/546-rohit-jain

