Horondi project
HORONDI project is an e-commerce online shop that provides hand-made backpacks, bags, purses and other accessories.
Installation
Required to install
- NodeJS (14.15.4)
Clone
- Clone this repo to your local machine using
https://github.com/ita-social-projects/horondi_client_be.git
Setup
install npm packages
$ npm install
How to run local
- Open terminal.
- Run
npm run start
to start application.* - Open http://localhost:5000/graphql to view it in the browser.
* - to run the project you need an .env
file in root folder
How to run Docker
download and install Docker Desktop
open terminal and run npm run docker-db-start
next launch Docker Desktop
and ensure your container is there and it is running
now you can use docker
command npm run test-server
- will connect to test server
command npm run test-docker
- will run docker and tests
Usage
How to run tests
To run unit test run Docker Desktop
then open terminal and run npm run test
in it.
Documentation
Rules and guidelines
-
File naming
- Files should be name in format
some-component.type.js
- Files should be name in format
-
Architecture
- Logic is separated in layers
- resolver layer (handles graphql actions)
- service layer (handles business logic, interactions with database)
- model layer (mapping collections to mongoose models)
- All business logic (any database operations or validation related to the business rules) and interaction with models is located inside service
- Each model should live in its own folder
- In each folder files should be named in format
{model-name}.{type}.js
(like{model-name}.service.js
or{model-name}.resolver.js
) - For each model we define class like
{ModelName}Service
in{model-name}.service.js
and have separate methods for handling different types of operations
- Logic is separated in layers
-
Configuration
- All configuration is implemented via environment variable that is located inside
.env
file
- All configuration is implemented via environment variable that is located inside
-
Testing
-
Tests are implemented in the format of contract tests. We test actual Graphql operations like queries, mutations, or subscriptions on the running application. For testing, we should use a database that is running as a container locally. We should have a folder per entity with tests.
-
Test files:
- {entityName}.queries.test.js - Testing the queries (if it exists)
- {entityName}.mutations.test.js - Testing the mutations (if it exists)
- {entityName}.subscriptions.test.js - Testing the subscriptions (if it exists)
-
Testing guides:
- All fields in data from the response from the backend should be checked for the appropriate value.
- If you cannot test some field for some particular value you should at least check its existence and its type.
- We should test the validation of the provided data to ensure that the backend performs validation by sending different combinations of valid and invalid data.
- Group tests for each operation (query, mutation, or subscription) to describe the statement.
Content (base scenario, for some operations we can have additional scenarios):
- describe(‘Validation’) with tests that validate a particular operation with combinations of valid and invalid data.
- describe(‘Success business logic’) with tests that perform operations with valid data and ensures that valid flows work
- Tests should be executed before any commit and don’t allow to push code if tests are failing.
- We need to develop utility functions that we can reuse in many tests files for creating user and base authentication (obtaining JWT token) for future performing operations that require authorization
-
Libraries
- jest - testing framework
- apollo-boost - client for performing Graphql operations
-
-
Runtime work
- Locally application is running in docker container. We have two docker
containers:
api
container anddatabase
container.
- Locally application is running in docker container. We have two docker
containers:
Testing
Generator
Command npm run generate
is used to run graphql code generator
-
before using codegen you must run backend server horondi backend
-
open terminal
-
run
npm run generate
-
you should run
npm run generate
every time new unions or interfaces are created
Project Deploy
https://horondi-front.azurewebsites.net/
Deploy Сlient part:https://horondi-admin.azurewebsites.net/
Deploy Admin Part:Contributing
You're encouraged to contribute to our project if you've found any issues or missing functionality that you would want to see. Here you can see the list of issues and here you can create a new issue.
Before sending any pull request, please discuss requirements/changes to be implemented using an existing issue or by creating a new one. All pull requests should be done into development
branch.
There are three GitHub projects: horondi_client_fe for frontend part, horondi_client_be for backend part and horondi_admin. Every project has it's own issues.
Every pull request should be linked to an issue. So if you make changes on frontend, backend or admin parts you should create an issue with a link to corresponding requirement (story, task or epic).
All Pull Requests should start from prefix #xxx-yyy where xxx - task number and and yyy - short description e.g. #020-createAdminPanel
Git flow
We have master , development and feature branches.
All feature branches must be merged into development branch!!!
Only the release should merge into the main branch!!!
Step 1
-
Option 1
👯 Clone this repo to your local machine usinghttps://github.com/ita-social-projects/horondi_client_be.git
-
Option 2
- create new branch from development branch
Step 2
- add some commits to your new branch
Step 3
🔃 Create a new pull request using github.com/ita-social-projects/horondi_client_be.
Issue flow
Step 1
-go to issues and click New issue
button
Step 2
when creating issue you should add name of the issue, description, choose assignee, label, project. If issue is a User Story
you should link it with corresponding tasks, and corresponding tasks should be linked to issue.
Step 3
if issue is in work it should be placed in proper column on dashboard according to its status.
Teams
Development team
Quality control team
ISTQB team
Database team
DevOps team
Designer team
FAQ
- How do I do specifically so and so?
- No problem! Just do this.
Support
License
- MIT license
- Copyright 2020 © SoftServe IT Academy.