This is an expand of the project of Studio-Ghibli Movie Tracker, it lets has roles in order to control the movie content, users, and even the admin users.
The project structure implements technologies like docker in order to mount image of mysql, hapi js framework of Node js, and GraphQL with helps from Apollo server for create the API. Finally, Deploy all the project in Digital Ocean.
Make sure that you have install node js, and docker which is a nice tool to container images of applications, we are going to use it to run an image of mysql; or you can run your local databa application.
⚠️ The projec would be run, once you have configure the enviroment variables (.env)
The following technologies are some of which that make up the project:
- Node.js
- Hapi.js
- Prisma
- MySQL
- GraphQL
- Docker
- Git
- Eslint
- Apollo-Server
So, let's talk about the tools that you need to run this app in your computer.
Install in your computer node.js.
Once node.js is installed on your pc, make sure that you have the latest npm version. Run this command:
$ npm intall npm@latest -g
The project uses the docker ecosystem in order to run a container of mysql, so to do that; download docker and docker compose.
Amazing! In this part we are talking about the steps to run the app in your local machine.
-
Clone the repository
git clone https://github.com/NousCode/BE-Backoffice.git
-
Go in the project directory
cd BE-StudioGhibliBackoffice
-
Install the dependences with:
npm install
-
Create a file .env, and put this code. This file configure the docker variables, and also the project.
⚠️ If you don't make this file, the app will not run.
DATABASE_URL="mysql://user:password@host:port/DB_name?schema=public"
# Variables environment
PORT=own_port
API_KEY=own_key
ENVIRONMENT=Development
DB_NAME=own_name
DB_PASSWORD=own_password
DB_PORT=own_port
PHPMA_PORT=own_port
# Variable for Auth0
# The url of your Auth0 tenant domain
AUTH0_ISSUER_BASE_URL
# Your Auth0 API's Identifier
AUTH0_AUDIENCE
- Before start to run the app, we have to make up the image container, so in the terminal run:
docker compose up -d --build
-
The last stap before run the app, it's the command
npx prisma migrate dev
for be able to have the entities and relations between them in your local machine. -
Finally, run the app with the command, Hello world! to Studio-Ghibli Backoffice:
npm run dev
In order to test the code of the project, run the next command, it runs a JestJS framework that help us to test code.
npm test
Eslinter is very helpful to find and fix problems in JavaScript and TypeScript code.
npm run lint
Process | Script | Description |
---|---|---|
Initialization | npm install |
Install all the dependences. |
Development | npm run dev |
Run the local server. |
Compile TS | npm run build |
Compile TS code into the dist directory. |
Testing | npm run test |
Run the test environment. |
Production | npm run prod |
Simule the production environment. |
ESLint | npm run lint |
Run ESLint helper. |
Precommit | npm run precommit |
Before makes a push at the repository, it run sESLint and fix with ESLint. |
In this part you can check how is the design of the Data Base, first image you are looking the ER diagram.
And this one, shows the relations and properties between entities, it is the physical diagram.
As a mention in the built with, the project is deployed in Digital Ocean's platform, just the Back end side. This is the link to it: Studio Ghibli Backoffice.
If you want to know ore details about the API functionality in GraphQL, take a look of the documentation. Documentation of the API
Whitout you, this would not be possible...
👨🍳 Ivan
👩🍳 Liliana
👨🍳 Guillermo
[C10-Squad-Search-Engine] 💚 Platzi Master