This repository includes:
- Express Server (backend API)
- Next.js App (frontend web)
Database access uses Prisma ORM with MariaDB.
Create a .env file in your Express server folder:
PORT=3001
DATABASE_URL="mysql://USERNAME:PASSWORD@HOST:PORT/DATABASENAME"
PEPPER=xxxxxx
JWT_SECRET=diegoredondi
WEBAPP_DOMAIN="mysite.com"Create a .env file in your Next.js frontend folder:
API_URL=http://localhost:3001
NEXT_PUBLIC_APP_NAME=my sagraIf deploying to production, update API_URL accordingly.
cd server
npm install
npx prisma generate
npx prisma migrate deploy #db prdouctioncd webapp
npm installYou MUST build and run both servers:
cd server
npm run build
npm run startcd webapp
npm run build
npm run starterDiagram
CATEGORY {
INT id
STRING name
}
FOOD {
INT id
STRING name
STRING description
DECIMAL price
INT categoryId
}
ORDER {
STRING id
DATETIME dateTime
STRING table
STRING customer
}
FOODSORDERED {
INT quantity
STRING orderId
INT foodId
}
ROLE {
INT id
STRING name
}
USER {
INT id
STRING username
STRING password
INT roleId
}
CATEGORY ||--o{ FOOD : has
FOOD ||--o{ FOODSORDERED : is_ordered_in
ORDER ||--o{ FOODSORDERED : includes
ROLE ||--o{ USER : has
USER }o--|| ROLE : assigned
To seed your database (e.g., to create your first admin user), i created a first seed with username: admin and password: admin, is recommended to delete it after create the first admin user
To run the seed:
npx prisma db seedFor more info, see the Prisma seeding docs.
You can find the API documentation made with SwaggerUI at the endpoint
http://[YOUR_URL]/api-docsFeel free to open an issue if you need help. Enjoy building! 🚀