Smaug is a full-stack database management application for a fictional cross-platform video game marketplace. It was built for a database systems course to demonstrate relational schema design, CRUD operations, stored procedures, and a React-based interface for managing marketplace data.
- Reid Pettibone
- Gavin Piper
Smaug models a game marketplace with customers, games, platforms, publishers, ESRB-style ratings, genres, carts, libraries, and purchases. The frontend provides table-based management pages for each major entity, while the backend exposes Express routes that read from and write to a MySQL database.
The application is split into two services:
backend/: Express API server connected to MySQL withmysql2frontend/: React + Vite client served in development by Vite and in production by a small Express static server
- View, create, update, and delete games
- Manage customers, publishers, genres, platforms, and ratings
- View customer carts and libraries
- View purchases and purchase item data
- Reset and reseed the database from the home page
- Use stored procedures for database reset and selected database operations
- Maintain many-to-many relationships such as games-to-platforms and games-to-genres
- React 18
- Vite
- React Router
- Node.js
- Express
- MySQL
mysql2nodemonfor developmentforeverfor production process management
.
├── backend/
│ ├── database/
│ │ └── db-connector.js
│ ├── routes/
│ │ ├── create.js
│ │ ├── read.js
│ │ ├── update.js
│ │ └── delete.js
│ ├── package.json
│ └── server.js
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── package.json
│ ├── reactServer.cjs
│ └── vite.config.js
├── CompletedDDL.sql
├── DML.sql
├── PL.sql
├── updatedDDL.sql
└── README.md
The schema includes the following main tables:
CustomersGamesPlatformsPublishersRatingsGenresGamePlatformsGenreItemsCartsCartItemsLibrariesLibraryItemsPurchasesPurchaseItems
CompletedDDL.sql contains schema definitions and sample data. PL.sql contains stored procedures, including sp_reset_gamedb, which is used by the backend reset route.
- Node.js and npm
- Access to a MySQL database
- A database initialized with the provided SQL files
Before running the app, review backend/database/db-connector.js and update the MySQL connection settings for your environment.
Important: do not commit real database passwords or class credentials to a public repository. Prefer environment variables for deployed or shared versions of this project.
Load the schema, seed data, and stored procedures into your MySQL database. A typical setup is:
mysql -u <username> -p <database_name> < CompletedDDL.sql
mysql -u <username> -p <database_name> < PL.sqlIf you are using separate schema and data files instead, load the DDL first, then DML.sql, then PL.sql.
Install backend dependencies:
cd backend
npm installInstall frontend dependencies:
cd frontend
npm installStart the backend API:
cd backend
npm run developmentStart the frontend development server in a second terminal:
cd frontend
npm run developmentThe backend currently listens on port 9680 in backend/server.js.
The frontend currently defines its backend URL in frontend/src/App.jsx. It is also noted that in production these ports should be kept in .env/secrets.
const backendPort = 9680;Start the backend with forever:
cd backend
npm run productionBuild and serve the frontend with forever:
cd frontend
npm run productionStop production processes:
cd backend
npm run stop_productioncd frontend
npm run stop_production/: Home page and database reset action/games: Games table/customers: Customers table/customers/:customerID/cart: Customer cart view/customers/:customerID/library: Customer library view/purchases: Purchases table/platforms: Platforms table/genres: Genres table/ratings: Ratings table/publishers: Publishers table
The backend organizes routes by CRUD operation.
GET /GET /gamesGET /customersGET /customers/:customerID/cartGET /customers/:customerID/libraryGET /purchasesGET /platformsGET /genresGET /ratingsGET /publishers
POST /games/createPOST /customers/createPOST /publishers/createPOST /genres/createPOST /platforms/createPOST /ratings/create
PUT /games/update/:idPUT /customers/update/:idPUT /publishers/update/:idPUT /genres/update/:idPUT /platforms/update/:idPUT /ratings/update/:id
DELETE /games/:idDELETE /customers/:idDELETE /publishers/:idDELETE /genres/:idDELETE /platforms/:idDELETE /ratings/:id
POST /admin/reset-db: callssp_reset_gamedbGET /__db: returns current database and MySQL user information
- Some boilerplate code was adapted from course modules.
- GenAI was used sparingly for repetitive tasks and feedback.
- This project was built as a course database management systems assignment.
No license is currently specified. Add a license before publishing if you want others to reuse or modify this project.