Code Monkey home page Code Monkey logo

express-typescript-seed's Introduction

Express Typescript Seed

Node.js with Express 4 written in Typescript

PostgreSQL database under Sequelize ORM

OAuth2 with Passport

Roles based access with Connect Roles

Message brokering with RabbitMQ for running background tasks like sending e-mails and uploading images to S3

Environment based configuration using Dotenv

Integration Testing with SuperTest

Quickstart

npm install -g yarn
yarn install
# install docker https://docs.docker.com/install/
docker stack deploy -c local-infra.yml infra
# connect to postgres via postgres:password@localhost:5432
# create 'seed' user with password 'password'
# create 'seed' database and set the 'seed' user as the owner
cp .env.example .env
yarn run start
# wait for app to start
yarn global add sequelize-cli
sequelize db:seed:all 

Environment Setup

This project uses the Dotenv library to load sensitive data such as database passwords and client secrets.

There is a .env.example file included at the root of this project as an example, rename it to '.env' (.env is not under version control). Update the .env file with the pertinent information for your project.

RabbitMQ

Install and run RabbitMQ with the default settings (or use the provided local-infra.yml in conjunction with docker-compose/swarm)

Database

You will need a PostgreSQL database running on localhost:5432 (or use the provided local-infra.yml in conjunction with docker-compose/swarm)

The setup of PostgreSQL is beyond the scope of this guide. Please reference the Install Guides for help installing PostgreSQL on your machine.

Once PostgreSQL is installed and running, create a new database called seed. Create a new user named seed. Make this user the owner of the newly created database.

Since the tables defined in the entities do not already exist, Sequelize will attempt to build them once you start the server.

Running the app

yarn install
yarn run start

You can also run the app in debug mode and attach a Debugger in Webstorm

yarn run debug

Once the app is running and the tables are created, you can seed the database with the sequelize-cli. Install the sequelize-cli by running

 yarn global add sequelize-cli

then run

sequelize db:seed:all 

Running the tests

yarn run test

Contact

Kevin Kolz - [email protected]

License

MIT

express-typescript-seed's People

Contributors

kckolz avatar stowns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

express-typescript-seed's Issues

How to Create a client

Sorry newbie here not an issue in the code but a question, how do I create a client. Do you have accompanying front end as well ?

How to run migrations?

I think this is a great project structure and I would use sequelize-typescript in production applications except for the fact that there does not seem to be a simple way to handle migrations. Have you figured out how to run migrations when defining your models like this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.