transport-passenger

Assignment Database System - Transport Passenger


Project maintained by huynhsamha Hosted on GitHub Pages — Theme by huynhsamha

transport-passenger

Assignment Database System - Transport Passenger System

NodeJS, Sequelize (Postgres SQL), ReactJS, Express.JS, Heroku (App, Postgre), AWS (EC2, S3)

Quickstart

Quick review source code (Optional)

Install extension on Chrome

Code structure

Clone source code

git clone https://github.com/huynhsamha/transport-passenger.git

Configure database

Create .env in root project (the file is ignored in .gitignore, because of security for production)

This project use Postgres SQL.

The file as similar for development:

DB_HOST=localhost
DB_PORT=5432
DB_NAME=transport_passenger
DB_USERNAME=example_username
DB_PASSWORD=example_password

See file config/db.js that use the file to export configure the database.

Installation

# use npm
npm install
# or can use yarn
yarn

PostgresSQL - pgAdmin 3

Install postgres (database) and pgAdmin 3 (tool development)

Start development

Fake data before start

To drop all table in your schema (default of postres is public schema):

yarn run db:drop

To create tables:

yarn run db:create

To clear data of tables (only clear data, sequences not reset):

yarn run db:clear

After run db:create, you can fake data or import available data by following options:

To fake data (maybe catch error):

yarn run db:fake

To import data: Open pgAdmin 3 and run script file scripts/import-data.sql

Run NodeJS

Before start NodeJS, use Oracle SQL Developer or other ways to open localhost and port for database you use for the project.

After above step, run:

# use npm
npm start 
# or can use npm
yarn start

Testing

Add your test files anywhere in server or test directory with *.spec.js

Run testing:

# use npm
npm run test 
# or can use yarn
yarn test

Commit code

The project uses husky for pre-commit code, that lints your code (eslint) and detect your bug syntax js before commit or push.

Environments (development, test, production)

In file .env, add

# example for domain
DOMAIN=https://domain.com

# example for session secret
SESSION_SECRET=emCNrg59au2fvhgr5RA9TBxvWyBhPRw2RdjZAXR79v5JfDAKMX

# email for project
EMAIL_ADDRESS=noreply.transport.passenger@gmail.com
EMAIL_PASSWORD=[contact someone who know password]

# amazon aws
AWS_ACCESS_KEY_ID=[your access key aws]
AWS_SECRET_ACCESS_KEY=[your secret access key aws]
AWS_S3_BUCKET=transport-passenger

APIs

View APIs here

Documents - Contributing

View Documents here

Deploy Heroku

View instructions here

Deploy AWS

View instructions here