This is a simple server side App offering a web API as well as a front based a GraphQL & MongoDB implementations.
- GraphQL implementation is available on the
graphql
branch as well asmaster
. - MongoDB implementation available on
mongo
branch.
The front-end uses ReactJs and Material design css with Material Components Web library:
- Redux for state management, Sagas for side-effects & Websocket for live updates on the
mongo
branch. - PrismaDB, Apollo is used on the
graphql
branch to interface with graphQL.
You must add your DATABASE
endpoints for your environments in the config
directory.
./
__config/
package.json
.env
...
The API is served by default on PORT:3000
.
The Web app is served by default on PORT:3001
.
You must have MongoDB installed on your machine or PrismaDB.
Env variables are loaded with dotenv.
Before running the project don't forget to add the following variables in your .env
file.
// MongoDB variables for differents environments...
DEV_DB
PROD_DB
// API endpoints, ports... for MongoDB, GraphQL
API_PORT=
// App env variables...
APP_PORT=
// Prisma DB variables: App & DB layers, Authentication/Encryption Token
PRISMA_DB_ENDPOINT=
PRISMA_DB_SECRET=
PRISMA_CLUSTER=
PRISMA_BEARER_TOKEN=
(Refer to the env
file for help)
mongo shell to test & debug.
- Runs on
PORT:3000
- Routes & endpoints:
/api/books/
/api/books/:id
/api/genres/
/api/genres/:id
- Mongoose ODM (Schema, Controllers):
./ __api/ ____resources/ ______ <resource>/ ________ index.js ________ <resource>.controller.js ________ <resource>.model.js ________ <resource>.router.js ... ______ router.js ______ index.js
- Application layer (GraphQL):
./ __/api/ ____schema.graphql ____index.js
- Database layer (Prisma & bindings):
./ __database/ ____datamodel.graphql ____prisma.yml
Additional documentation:
- Running the project:
npm run start
- Developing:
npm run dev
- Running the web API:
npm run api
- Running the web server:
npm run server
- Bundling the artefacts:
npm run build
- (optional) mongoDB cluster:
npm run db
- Testing.
- CI/CD.
- Styling on the
graphql
branch.