Backend + Owner/Admin dashbord + Vendor dashboard + Marketplace Storefront + postgres + redis + MinIO
Any questinos about MercurJS on Railway? Ask here: https://station.railway.com/templates/mercurjs-10ceb1ef
Before starting, ensure you have the following installed:
- Node.js 20+ (Recommended: v22.13.1)
- PostgreSQL 14+ (Running locally on port 5432)
- pnpm (Package manager)
mercurjs-for-railway-boilerplate/
βββ backend/ # Mercur backend (MedusaJS)
βββ admin-panel/ # Admin dashboard (React/Vite)
βββ vendor-panel/ # Vendor/seller dashboard (React/Vite)
βββ storefront/ # Customer-facing storefront (Next.js)
All dependencies are already installed, but if you need to reinstall:
# Backend
cd mercurjs-for-railway-boilerplate/backend
pnpm install
# Admin Panel
cd ../admin-panel
pnpm install
# Vendor Panel
cd ../vendor-panel
pnpm install
# Storefront
cd ../storefront
pnpm installMake sure PostgreSQL is running, then create the database:
# Connect to PostgreSQL
psql -U postgres
# Create database
CREATE DATABASE mercurjs;
# Exit
\qEnsure Redis is running on port 6379. You can verify with:
redis-cli ping
# Should return: PONGcd mercurjs-for-railway-boilerplate/backend
npx medusa db:migratecd mercurjs-for-railway-boilerplate/backend
pnpm seedcd mercurjs-for-railway-boilerplate/backend
npx medusa user -e admin@test.com -p supersecretYou need to run all four services in separate terminal windows:
cd mercurjs-for-railway-boilerplate/backend
pnpm devRuns on: http://localhost:9000
cd mercurjs-for-railway-boilerplate/admin-panel
pnpm devRuns on: http://localhost:5173
cd mercurjs-for-railway-boilerplate/vendor-panel
pnpm devRuns on: http://localhost:7001
cd mercurjs-for-railway-boilerplate/storefront
pnpm devRuns on: http://localhost:3000
| Service | URL | Login Credentials |
|---|---|---|
| Backend API | http://localhost:9000 | N/A |
| Admin Panel | http://localhost:5173 | admin@test.com / supersecret |
| Vendor Panel | http://localhost:7001 | vendor@test.com / supersecret |
| Storefront | http://localhost:3000 | N/A |
All environment files have been created:
- Backend:
mercurjs-for-railway-boilerplate/backend/.env - Storefront:
mercurjs-for-railway-boilerplate/storefront/.env.local - Admin Panel:
mercurjs-for-railway-boilerplate/admin-panel/.env - Vendor Panel:
mercurjs-for-railway-boilerplate/vendor-panel/.env
DATABASE_URL=postgres://postgres:postgres@localhost:5432/mercurjs
REDIS_URL=redis://localhost:6379
JWT_SECRET=supersecret
COOKIE_SECRET=supersecretMEDUSA_BACKEND_URL=http://localhost:9000
NEXT_PUBLIC_BASE_URL=http://localhost:3000VITE_MEDUSA_BACKEND_URL=http://localhost:9000
VITE_MEDUSA_STOREFRONT_URL=http://localhost:3000VITE_MEDUSA_BACKEND_URL=http://localhost:9000
VITE_MEDUSA_STOREFRONT_URL=http://localhost:3000Railway Deployment: When deploying to Railway using the deploy button, MinIO object storage is fully configured and ready to use. All file uploads (product images, etc.) are automatically stored in a MinIO bucket.
Local Development: The project automatically falls back to disk storage (files are saved in the backend/static folder) for easy local setup - no additional configuration needed.
To manually configure MinIO for local development, add these variables to backend/.env:
MINIO_ENDPOINT=your-minio-endpoint.com
MINIO_ACCESS_KEY=your-access-key
MINIO_SECRET_KEY=your-secret-key
MINIO_BUCKET=custom-bucket-name # Optional, defaults to 'medusa-media'If you get database connection errors:
-
Verify PostgreSQL is running:
pg_isready -U postgres
-
Check the connection string in
backend/.env:DATABASE_URL=postgres://postgres:postgres@localhost:5432/mercurjs
-
Ensure the database exists:
psql -U postgres -l | grep mercurjs
If you get Redis connection errors:
-
Verify Redis is running:
redis-cli ping
-
Check Redis URL in
backend/.env:REDIS_URL=redis://localhost:6379
If a port is already in use, you can:
-
Kill the process using the port (Windows):
netstat -ano | findstr :9000 taskkill /PID <PID> /F
-
Or change the port in the respective service's configuration
Mercur requires Node.js 20+. Check your version:
node --versionIf using nvm:
nvm use 22# Run migrations
pnpm medusa db:migrate
# Seed database
pnpm seed
# Create admin user
pnpm medusa user -e email@example.com -p password
# Build for production
pnpm build
# Start production server
pnpm start# Development mode
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview# Development mode
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview# Development mode
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start- Backend uses MedusaJS v2 with the MercurJS B2C marketplace plugin
- Admin Panel is a standalone React/Vite application with custom marketplace administration features
- Vendor Panel is a standalone React/Vite application for vendors/sellers to manage their products and orders
- Storefront is built with Next.js and includes marketplace-specific components
- All services communicate through the backend API on port 9000
After running migrations, the following key tables will be created:
- Products, Variants, Inventory
- Orders, Payments, Fulfillments
- Customers, Users
- Sellers (marketplace-specific)
- Commissions (marketplace-specific)
- And many more...
- Change all secrets in
.envfiles - Use strong passwords for PostgreSQL and admin users
- Configure proper CORS settings
- Enable HTTPS
- Use environment-specific configurations
This project is based on MercurJS and MedusaJS. Please refer to their respective licenses.
- Access the admin panel at http://localhost:5173
- Login with your admin credentials
- Configure your store settings
- Add products
- Visit the storefront at http://localhost:3000
Happy selling! π