A full-fledged ecommerce RESTFul API, built with TypeScript, Express.js, and Prisma PostgreSQL.
Check out the live version deployed here.
Built with modular Express.js and type-safe TypeScript, Game Store API is an ecommerce RESTFul API that offers all you need to display your game products to game enthusiasts: games, genres, platforms and publishers.
Game Store API is highly scalable and customizable, thanks to the unopinionated nature of Express.js. It supports role-based, JWT authentication and preview images upload.
Game Store API is built to be easily integrated into and used with any frontend system effortlessly.
- ✅ RESTFul API with support for games, genres, platforms and publishers.
- ✅ Role-based, JWT authentication using Passport.js.
- ✅ Preview images upload.
- ✅ Support for JSON and multipart form data.
- ✅ Effortless database migration and deployment with Prisma and a custom seeding and purging script (
src/seed.ts). - ✅ Comprehensive input validation and sanitization.
- Clone the repository:
git clone https://github.com/ahmadnourallah/game-store-api- Install dependencies:
npm installBefore starting the server, you should make sure to define the following environment variables:
PORT: The port which the development server will listen on. Default:3000.DB_URL: The postgresql url of the database. A postgresql database url has the following format:postgres://username:password@hostname:5432/database.JWT_SECRET: A confidential cryptographic key used to sign and verify JWTs for authentication. You can generate a random one using:node -e "console.log(require('crypto').randomBytes(32).toString('hex'));".JWT_EXPIRATION_TIME: The period after which a generated JWT expires and has to be resigned. Default:2d.ADMIN_EMAIL: The autogenerated superuser's email. By runningnpm run seed, an admin account is generated using the values of this variable and the following ones. Default:admin@gmail.com.ADMIN_PASS: The autogenerated superuser's password. Default:admin123!.ADMIN_NAME: The autogenerated superuser's name. Default:Admin.
WARNING: Do NOT use the default values of ADMIN_EMAIL and ADMIN_PASS in production.
You can fire up the development server using:
npm run devBuilding the application can be done by running:
npm run buildYou can preview the production build through:
npm run startMoreover, you can use npm run purge to empty all tables and npm run seed to create the default admin account. Moreover, npm run seed will create dummy game data and download preview images from the RAWG API.
The system is built with the latest technologies:
- TypeScript
- Node.js
- Express.js
- Prisma
- Passport.js
- Express Validator
This project is licensed under the GNU GPLv3 License - see the LICENSE.md file for details.