Skip to content

Commit

Permalink
doc: update the main README
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Nov 28, 2021
1 parent 6d7ee0a commit afb6550
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 10 deletions.
101 changes: 100 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,118 @@ Get information about programming languages

![Website](https://prolanghistory.com/assets/img/og.png)

# Features
- Retrieve all programming languages
- Retrieve programming languages by a group of years (the 1940s, 1950s, 1990s, 2000s, etc.)
- Retrieve successors and predecessors of a language
- Retrieve programming languages authors

## Prerequisites
- Node.js 12+
- Yarn or NPM
- MongoDB 4+
- Docker and Docker Compose

## Installation
Clone the project and install the dependencies for each project
```shell
git clone https://github.com/osscameroon/prolang-api.git
cd prolang-api/apidoc && yarn install
cd ../backend && yarn install
cd ../frontend && yarn install
```
If you want to launch the application locally with configuring each project, run the command below
at the project root directory
```shell
docker-compose up -d
```
Wait for the application to be ready then, navigate to `http://localhost:5701` and explore the app.

## Backend
The backend interacts with a Mongo database so, make sure you set up one before continuing.
Check out [this tutorial](https://blog.tericcabrel.com/enable-authentication-and-authorization-on-mongodb/) to see how to set up.

Create the environment file from the template and update the database URL to your
```shell
cp .env.tempalte .env
nano .env # update the properties, save and exit
```
Generate GraphQL types and start the application
```shell
yarn generate:types
yarn start
```
- Navigate to `http://localhost:5700` for the REST API
- Navigate to `http://localhost:5700/graphql` for the GraphQL Playground

## Apidoc
No additional action is required here to start working.
Check out the Readme inside the project for more details

## Frontend
Make sure the Backend is up and running before launching this project.

Create the environment file from the template and start the project
```shell
cp .env.template .env.development.local
yarn dev
```
Navigate to `http://localhost:5701` to view the website

## Testing
Every project has tests to validate the integrity of the feature before shipping in production.

### Apidoc
The test verifies that the API definition is valid according to the OpenAPI specification.
Run the command to validate:
```shell
yarn lint
```

### Backend
The purpose is to make sure critical features of the application still work as expected by running
unit and integration tests.

Testcontainers is used to create a database for testing purpose.
So, you don't have to worry about your local DB is being polluted.
```shell
yarn test
```

### Frontend
As same as for the Backend, unit and end-to-end tests are written on the critical component.
Cypress is used to testing the navigation flow of the application.
Jest is used to test component behavior

Run end-to-end tests with Cypress:
```shell
yarn test:it
# to launch it in headless browser mode
yarn test:it:ci
```

Run component tests with Jest
```shell
yarn test
```

## Deployment
We use GitHub Action for Continuous Integration and Continuous Delivery.

- The frontend deployment is handled by Vercel Bot that gives you a preview of the website
when you create a pull request. It is deployed in production once merged on the main branch


- The backend deployment is handled also automated through a bash script that connects to the production server, pulls the new docker image, and runs it.

## How to contribute

- Create an issue where you explain clearly the problem you want to solve
- Make a Pull Request
- If it's relevant, we're going to merge it.
Yeah, it's simple as this!


## License

## Deployment
- [GPLv3](https://www.gnu.org/licenses/gpl-3.0-standalone.html)
3 changes: 2 additions & 1 deletion frontend/.env.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NEXT_PUBLIC_APP_URL=http://localhost:5701
NEXT_PUBLIC_API_URL=http://localhost:5700
NEXT_PUBLIC_API_DOC_URL=http://localhost:5700
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:5700/graphql
NEXT_PUBLIC_GA_ID=
NEXT_PUBLIC_CLIENT_ORIGIN=browser
NEXT_PUBLIC_CLIENT_ORIGIN=brwsr
8 changes: 0 additions & 8 deletions yarn.lock

This file was deleted.

1 comment on commit afb6550

@vercel
Copy link

@vercel vercel bot commented on afb6550 Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.