A full-stack e-commerce platform for groceries in the San Jose Downtown area, featuring online shopping, automated delivery optimization, and inventory management.
- π Overview
- β¨ Key Features
- π Tech Stack
- π Architecture Overview
- π Quick Start
- π Environment Setup
- π Database Access
- π Docker Compose
- π» Development
- π Health Checks
- π Support
- Demo Video
OFS is a modern web application that enables customers to purchase organic foods online and have them delivered by simulated autonomous vehicles. The system includes inventory management, order processing, delivery optimization, and a comprehensive dashboard for store employees and managers.
- Browse and purchase organic foods (fruits, vegetables, groceries)
- Virtual shopping cart with item weight tracking
- Online payment processing with Stripe
- Automatic delivery fee calculation
- β Free delivery for orders under 20 lbs
β οΈ $10 delivery fee for orders 20+ lbs
- Order tracking and simulated delivery
Authentication & Session Management
- Secure user authentication with JWT cookies
- JWT blacklisting on logout using Redis
- HTTP-only cookies for sensitive data
Request Protection
- CSRF token protection for all API endpoints
- Rate limiting
- Strict CORS policy with credentials
Data Security
- Input validation and sanitization using Express Validator
- Secure password hashing
- Bull queue for delivery job processing
- Capacity: 10 orders per robot trip (up to 200 lbs total)
- Automated route optimization using Mapbox API
- Admin inventory management dashboard
- CRUD operations on products
| Category | Technologies |
|---|---|
| Frontend | |
| Backend | |
| Database | |
| Services | |
| Queue | |
| DevOps |
graph TD
A[Client - Port 6422] --> B[Server API - Port 6423]
B --> C[MySQL - Port 6424]
B --> D[Redis]
B --> E[Stripe API]
B --> F[Mapbox API]
The application consists of four main services orchestrated with Docker Compose:
| Service | Description | Port |
|---|---|---|
| MySQL | Primary relational data storage | 6424 |
| Redis | JWT blacklisting & Bull queue management | Default |
| Server | Node.js/Express API backend | 6423 |
| Client | React frontend served by Nginx | 6422 |
- Docker Desktop installed (Download here)
- Stripe CLI installed (Download here)
- Stripe CLI is necessary for payment integration on a local development environment
- While installing MySQL is not necessary to test our application, if you wish to inspect the database records, install MySQL Shell and Server (Download here)
- Log in to Stripe with test account credentials. To obtain the Stripe test account credentials, please contact:
- π§ Email: michael.stephen.huh@gmail.com
- π¬ Discord: mikrelin
- Environment variables configured (see Environment Setup)
-
Clone the repository
git clone git@github.com:mikeshuh/OFS.git
Alternatively, just copy the docker-compose.yml file into a folder on your file system.
-
Set up environment variables
- Create
.envfile in root directory (where the docker-compose.yml file is) - Contact for credentials (see below)
- Create
-
Start containers
docker compose up -d
-
Run Stripe CLI
stripe login
Make sure you log in on the OFS account in Test mode.
stripe listen --forward-to localhost:6423/api/payments/webhook
Ensure the webhook signing secret displayed in the terminal matches the one we provide for your
.env. -
Access the application
- π Frontend: http://localhost:6422
- π API: http://localhost:6423
- ποΈ MySQL: localhost:6424
To obtain the necessary environment variables, please contact:
π§ Email: michael.stephen.huh@gmail.com
π¬ Discord: mikrelin
The environment file includes:
- Database credentials
- API keys (Stripe, Mapbox)
- JWT secrets
- Redis connection details
- Other application-specific settings
To connect to the MySQL database directly:
# Connect to MySQL from your local machine
mysql -P 6424 -u root -pWhen prompted for a password, enter the MYSQL_ROOT_PASSWORD value from your .env file.
This gives you direct access to manage the database, run queries, and inspect data.
NOTE: If you are on a M1 Mac, uncomment the platform specification lines for each service.
services:
mysql:
image: mikeshuh/ofs-mysql:latest
# platform: linux/amd64 # Uncomment this line if you are using a M1 Mac
build:
context: ./database
dockerfile: Dockerfile
env_file: .env
volumes:
- db_data:/var/lib/mysql
ports:
- "6424:3306" # Maps host port 6424 to container port 3306
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$${MYSQL_ROOT_PASSWORD}"]
interval: 5s
timeout: 5s
retries: 10
start_period: 30s
redis:
image: redis:7-alpine
# platform: linux/amd64 # Uncomment this line if you are using a M1 Mac
restart: unless-stopped
command: ["redis-server","--appendonly","yes"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 3
server:
image: mikeshuh/ofs-server:latest
# platform: linux/amd64 # Uncomment this line if you are using a M1 Mac
build:
context: ./server
dockerfile: Dockerfile
env_file: .env
ports:
- "6423:4000"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL","curl -f http://localhost:4000/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3
client:
image: mikeshuh/ofs-client:latest
# platform: linux/amd64 # Uncomment this line if you are using a M1 Mac
build:
context: ./client
dockerfile: Dockerfile
ports:
- "6422:80"
depends_on:
- server
restart: unless-stopped
volumes:
db_data:
redis_data:Ensure the host ports (6422, 6423, 6424) are not already in use.
# Build all services
docker compose build
# Build specific service
docker compose build mysql
docker compose build server
docker compose build client# All services
docker compose logs -f
# Specific service
docker compose logs -f server# Stop all services
docker compose down
# Stop and remove volumes (β οΈ deletes data)
docker compose down -v| Service | Check Method | Interval |
|---|---|---|
| MySQL | mysqladmin ping |
5s |
| Redis | redis-cli ping |
5s |
| Server | http://localhost:6423/health |
30s |
For assistance or to report issues:
- π§ Email: michael.stephen.huh@gmail.com
- π¬ Discord: mikrelin
https://drive.google.com/file/d/1nknXU9W_R50UTYkf0QjciaxxmUw7oNbm/view?usp=sharing
Contact Michael at michael.stephen.huh@gmail.com or on Discord (mikrelin)
