Skip to content

nepalcodes/unitednepali

Repository files navigation

United Nepali

Netlify Status End-to-end tests

👋 Welcome to United Nepali!

This project is about building a platform to make it easier for Nepali organizations and individuals to collaborate with each other!

If you would like to join us please reach out on SLACK or send us an email at: team@nepalcodes.com!

Getting started

After a clone, in the root level of this repo run:

# Install all the dependencies
npm install

# Call bootstrap script to bootstrap the monorepo
npm run bootstrap

# Starting the application
npm run start

UI runs on http://localhost:8080 and server runs on http://localhost:3000

Docker Workflow

The project is also configured for a containerized workflow, currently there are 4 services:

  • unitednepali-server (express server): this is the backend service for the web application
  • unitednepali-client (react frontend): this is the react frontend, managed by gatsby
  • unitednepali-db (postgres db): postgres database
  • unitednepali-nginx (nginx): nginx webserver, which can also be used as a reverse proxy

Each service is built and deployed through Docker, see corresponding service's Dockerfile for details. We use docker-compose to orchestrate all the services together. See Docker site for OS specific installation instructions.

Building and running locally

Supplied is a docker-compose.yml file, this defines the orchestration of all the containers.

# build, (re)creates, start and attaches to containers
docker-compose up --build

# build, (recreates), start, detached mode (run containers in background):
docker-compose up -d --build

# teardown all containers
docker-compose down

Once containers are built and running, you can check if the app is running on your browser at http://localhost, unitednepali api is correspondingly running on http://localhost/api/.

See docker documentation for full usage of docker-compose commands.

Running e2e tests

Project uses cypress for end-to-end testing, to run the tests:

# to run and open cypress
npm run test

# To just run the e2e tests
npm run test-run

FAQ

I'm getting an error when I try to run an npm command Make sure you've run npm install and npm run bootstrap

How to add a new npm package to the client or server package We use lerna to maintain the npm packages and our own javascript packages:

# we currently manage 2 packages with lerna unitednepali-client and unitednepali-server
lerna add [npm-package-name] --scope unitednepali-client

Running eslint to analyze the javascript source code

# to just run eslint on .js and .jsx files
npm run lint

# to run lint and fix the flagged violations
npm run lint-fix

# to run eslint and see a html report, output will be in .test/eslint-report.html
npm run lint-report

What techonlogies do we use

  • React for frontend components, client side code lives under packages/client.
  • Express for backend server, server code lives under packages/server.
  • Lerna for managing our javascript projects which are all under packages.
  • Gatsby for frontend framework and static site generation.
  • Cypress for end to end testing our application.
  • Docker encompass the project in containers.
  • Postgres as our sql database.

Project Structure

.
├── README.md
├── cypress
│   ├── fixtures
│   ├── integration
│   ├── plugins
│   ├── support
│   └── videos
├── cypress.json
├── docker
├── docker-compose.yml
├── lerna.json
├── package-lock.json
├── package.json
├── packages
│   ├── client
│   └── server
└── services
    ├── db
    └── nginx