All Projects → kriasoft → node-starter-kit

kriasoft / node-starter-kit

Licence: MIT License
Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Handlebars
879 projects
shell
77523 projects

Projects that are alternatives of or similar to node-starter-kit

React Native Navigation Redux Starter Kit
React Native Navigation(v2) Starter Kit with Redux, Saga, ESLint, Babel, Jest and Facebook SDK 😎
Stars: ✭ 271 (+256.58%)
Mutual labels:  babel, starter, starter-kit
typescript-api-starter
🔰 Starter for Node.js express API in Typescript 🚀
Stars: ✭ 72 (-5.26%)
Mutual labels:  knex, seed, knexjs
Webpack Starter Basic
A simple webpack starter project for your basic modern web development needs.
Stars: ✭ 552 (+626.32%)
Mutual labels:  seed, starter, starter-kit
Gulp Scss Starter
Frontend development with pleasure. SCSS version
Stars: ✭ 339 (+346.05%)
Mutual labels:  babel, starter, starter-kit
Wordpress Starter
📦 A starter template for WordPress websites
Stars: ✭ 26 (-65.79%)
Mutual labels:  babel, starter, starter-kit
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-48.68%)
Mutual labels:  postgres, starter, starter-kit
Gulp Pug Starter
Frontend development with pleasure. Pug + SCSS version
Stars: ✭ 228 (+200%)
Mutual labels:  babel, starter, starter-kit
Pug Starter
Simple pug (jade) starter [framework] enabling faster delivery of HTML & CSS projects to a private server and/or automatic deployment of GitHub pages.
Stars: ✭ 328 (+331.58%)
Mutual labels:  website, starter, starter-kit
SampleProject
A starter project for Sample Project in Objective C. Objective C version of https://github.com/xeieshan/SwiftySampleProject
Stars: ✭ 31 (-59.21%)
Mutual labels:  starter, starter-kit
example-typescript-package
Example TypeScript Package ready to be published on npm & Tutorial / Instruction / Workflow for 2021
Stars: ✭ 71 (-6.58%)
Mutual labels:  starter, starter-kit
cosmic
🌱🌌 Seed for a universal (native iOS, native Android, web, desktop) app based on react native web, redux and Typescript
Stars: ✭ 32 (-57.89%)
Mutual labels:  seed, starter-kit
starter-reactnative-nestjs-mysql
Starter mobile ReactNative NestJS MySQL with continuous integration and AWS deployment
Stars: ✭ 16 (-78.95%)
Mutual labels:  starter, starter-kit
BotBlock.org
BotBlock - The List of Discord Bot Lists and Services
Stars: ✭ 29 (-61.84%)
Mutual labels:  knex, knexjs
relay-starter-kit
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, Material UI.
Stars: ✭ 3,513 (+4522.37%)
Mutual labels:  postgres, starter-kit
botfuel-sample-starter
Starter bot using Botfuel Dialog
Stars: ✭ 24 (-68.42%)
Mutual labels:  starter, starter-kit
ng-seed
Simple Angular seed project with commonly used features.
Stars: ✭ 12 (-84.21%)
Mutual labels:  seed, starter
kex
ORM-less for Knex
Stars: ✭ 17 (-77.63%)
Mutual labels:  knex, knexjs
noise-php
A starter-kit for your PHP project.
Stars: ✭ 52 (-31.58%)
Mutual labels:  starter, starter-kit
modernization-cookbook-template
Starter Cookbook for Application Modernization and Replatforming Engagements
Stars: ✭ 14 (-81.58%)
Mutual labels:  seed, starter-kit
react-flux-gulp-starter
A universal boilerplate for building React/Flux apps using Gulp and ES6.
Stars: ✭ 46 (-39.47%)
Mutual labels:  babel, starter

Node.js API Starter Kit

Node.js API Starter Kit is a project template for building Node.js backend applications optimized for serverless infrastructure such as Google Cloud Functions, AWS Lambda, Azure Functions, etc. Use it as an API server for your front-end app.

Features

  • Database first design; auto-generated strongly typed data models (TypeScript)
  • Authentication and authorization using OAuth 2.0 providers (Google, Facebook, GitHub, etc.)
  • Stateless sessions implemented with JWT tokens and a session cookie (compatible with SSR)
  • GraphQL API example, implemented using the code-first development approach
  • Database schema migration, seeds, and REPL shell tooling
  • Transactional emails using Handlebars templates and instant email previews
  • Structured logs and error reporting to Google StackDriver
  • Pre-configured unit testing tooling powered by Jest and Supertest
  • Application bundling with Rollup as an optimization technique for serverless deployments
  • Rebuilds and restarts the app on changes when running locally
  • Pre-configured for local, dev, test, and prod environments
  • The ongoing design and development is supported by these wonderful companies:

    


This project was bootstrapped with Node.js API Starter Kit. Be sure to join our Discord channel for assistance.

Tech Stack

Directory Structure

├──.build — Compiled and bundled output (per Cloud Function)
├──.vscode — VSCode settings including code snippets, recommended extensions etc.
├──api — Cloud Function for handling API requests using GraphQL.js
├──auth — Authentication and session middleware
├──core — Common application modules (email, logging, etc.)
├──db — Database client for PostgreSQL using Knex
├──emails — Email templates for transactional emails using Handlebars
├──env — Environment variables for local, dev, test, and prod
├──migrations — database schema migrations (Cloud SQL, Knex)
├──scripts — Deployment scripts, REPL shell, etc.
├──test — Unit tests and benchmarks
├──views — HTML templates using Handlebars
└── ... — add more cloud functions such as worker, notifications, etc.

Requirements

Getting Started

  • Clone the repo — git clone -o seed https://github.com/kriasoft/node-starter-kit.git.
  • Update environment variables for local, dev, test, and prod environments (./env).
  • Install project dependencies — yarn install
  • Bootstrap PostgreSQL database — yarn db:create
  • Finally, launch the app — yarn start, it will become available at http://localhost:8080.

Use APP_ENV environment variable to execute scripts for different environments, for example:

$ APP_ENV=test yarn db:migrate
$ APP_ENV=test yarn start

IMPORTANT: Ensure that VSCode is using the workspace versions of TypeScript and ESLint.

Scripts

  • yarn start — Launches the app in development mode on http://localhost:8080
  • yarn build — Compiles and bundles the app for deployment
  • yarn lint — Validate code using ESLint
  • yarn tsc — Validate code using TypeScript compiler
  • yarn test — Run unit tests with Jest, Supertest
  • yarn repl — Connect to the database using Knex REPL shell
  • yarn psql — Connect to the database using PostgreSQL CLI
  • yarn db:create — Create a new database
  • yarn db:version — Check the current version of the database
  • yarn db:migrate — Migrate database schema to the latest version
  • yarn db:rollback — Rollback the latest migration
  • yarn db:seed — Seed database with sample / reference data
  • yarn db:reset — Re-apply the latest DB schema migration file
  • yarn update-types — Generate strongly typed data models from database schema

Optionally set APP_ENV to local (default), dev, test, or prod before running these scripts.

How to Configure 0Auth 2.0 Login Flow

For each 3rd party identity provider that needs to be enabled for your app, you will need to obtain application credentials, often called client ID/secret.

Google

From there on, visiting http://localhost:8080/auth/google (or, opening it in a popup window) would initiate login flow via Google.

Facebook

  • Go to Facebook Developer website
  • Create a new Facebook App, enable Facebook Login for this app
  • Close Quickstart dialog and go straight to the app settings
  • Add http://localhost/auth/facebook/return as the callback URL for the login flow
  • Copy and paste the newly created Facebook App ID and secret to FACEBOOK_APP_ID, FACEBOOK_APP_SECRET variables found in env/.env.* files for each environment that you need.

From there on, visiting http://localhost:8080/auth/facebook (or, opening it in a popup window) would initiate login flow via Facebook.

How to Deploy

The deployment script (yarn deploy) relies on Google Cloud CLI (gcloud) tool that you can download from here. For CI/CD workflows you may need a Docker image like this one.

gcloud auth login — Authorize Google Cloud SDK (CLI) tool to use your Google account.

Create a new GCP project for your app with IDs such as example for production, and example-test for test / QA environments. Ensure that Cloud Build API and Cloud Functions API are enabled in your GCP project's settings here.

Create a Cloud SQL database instance here in the same region where your app needs to be deployed. Using a micro instance of Cloud SQL with 0.6 GB RAM should be OK for testing and low traffic websites.

Ensure that GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_REGION, PGDATABASE, PGUSER and the other environment variables are correctly set for the target deployment environment (e.g. /env/.env + /env/.env.prod for production).

Finally, compile and deploy the app by running:

  • yarn build — Compiles the app into the .build folder
  • APP_ENV=<env> yarn db:migrate — Migrates database (schema) to the latest version
  • APP_ENV=<env> yarn deploy — Deploys the app to Google Cloud Functions (GCF)

Where <env> is the target environment, e.g. APP_ENV=prod yarn deploy.

How to Update

  • yarn set version latest — Bump Yarn to the latest version
  • yarn upgrade-interactive — Update Node.js modules (dependencies)
  • yarn pnpify --sdk vscode — Update TypeScript, ESLint, and Prettier settings in VSCode

Backers

              

Related Projects

How to Contribute

Anyone and everyone is welcome to contribute. Start by checking out the list of open issues marked help wanted. However, if you decide to get involved, please take a moment to review the guidelines.

License

Copyright © 2016-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE file.


Made with by Konstantin Tarkus (@koistya, blog) and contributors.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].