Skip to content

NanoSpicer/typescript-backend-starter

Repository files navigation

🎉🎉 typescript-backend-starter 🎉🎉

Prerequisites:

  • nodejs
  • postgres

Make yourself home ☕

Initialize your workspace

$ npm run setup

optionally 🙂

$ npm run seed

And finally ✨

$ npm start

Libraries

  • 🕸 Interfacing – GraphQL
  • 🖥 Server – Fastify
  • 💾 DatabaseAccess – Knex
  • 🧪 Testing – Jest
  • 💻 Language – TypeScript

Environments (NODE_ENV)

  • Use 'development' or leave blank to use the dev environment
  • Use 'prod' to use the production environment

Knex 💾, your everyday cookbook 🧑‍🍳

Pass an env

$ npx knex migrate:latest --env envname

Seeding

  • Creating
$ npx knex seed:make name
  • Running
$ # by default runs all of em, you may specify
$ # a seed to run
$ npx knex seed:run [options]

Create a migration

  • Creating
$ npx knex migrate:make name
  • Running
# Run a single migration up
$ npx knex migrate:up 

# Run a single migration down
$ npx knex migrate:down

# Run all pending migrations
$ npx knex migrate:latest 

# Run back all the latest migrations
$ npx knex migrate:rollback

Know more by just running:

# All knex options
$ npx knex
# Docs about a command
$ npx knex help command

About

A NodeJS backend starter using Fastify(Server), Apollo Fastify (for GraphQL), Knex (DB Access), Jest (Tests), ESLint (Linter) and TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published