All Projects → hongymagic → K2

hongymagic / K2

Koa2 API template with passport, GraphQL, flowtype, knex and more.

Programming Languages

javascript
184084 projects - #8 most used programming language
flowtype
47 projects

Projects that are alternatives of or similar to K2

Blog Service
blog service @nestjs
Stars: ✭ 188 (+327.27%)
Mutual labels:  graphql, koa2, jest
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (+24825%)
Mutual labels:  graphql, postgresql, koa2
Koa Starter
An opinionated Koa starter kit
Stars: ✭ 10 (-77.27%)
Mutual labels:  postgresql, koa2, jest
Subzero Starter Kit
Starter Kit and tooling for authoring GraphQL/REST API backends with subZero
Stars: ✭ 136 (+209.09%)
Mutual labels:  graphql, postgresql, starter-kit
Express Graphql Boilerplate
Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 201 (+356.82%)
Mutual labels:  graphql, postgresql, jest
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+7575%)
Mutual labels:  graphql, postgresql, starter-kit
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-11.36%)
Mutual labels:  graphql, postgresql, starter-kit
Laravel Vue Boilerplate
🐘 A Laravel 6 SPA boilerplate with a users CRUD using Vue.js 2.6, GraphQL, Bootstrap 4, TypeScript, Sass, and Pug.
Stars: ✭ 472 (+972.73%)
Mutual labels:  graphql, jest
Openrecord
Make ORMs great again!
Stars: ✭ 474 (+977.27%)
Mutual labels:  graphql, postgresql
Clean Ts Api
API em NodeJs usando Typescript, TDD, Clean Architecture, Design Patterns e SOLID principles
Stars: ✭ 619 (+1306.82%)
Mutual labels:  graphql, jest
Postgrest Starter Kit
Starter Kit and tooling for authoring REST API backends with PostgREST
Stars: ✭ 657 (+1393.18%)
Mutual labels:  postgresql, starter-kit
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+9822.73%)
Mutual labels:  graphql, postgresql
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+47763.64%)
Mutual labels:  graphql, starter-kit
Pepperoni App Kit
Pepperoni - React Native App Starter Kit for Android and iOS
Stars: ✭ 4,657 (+10484.09%)
Mutual labels:  starter-kit, jest
Entria Fullstack
Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
Stars: ✭ 434 (+886.36%)
Mutual labels:  graphql, jest
Serverless Typescript Starter
🗄🙅‍♀️ Deploy your next serverless JavaScript function in seconds
Stars: ✭ 653 (+1384.09%)
Mutual labels:  starter-kit, jest
Graphql Dataloader Boilerplate
Very simple boilerplate using GraphQL and DataLoader
Stars: ✭ 405 (+820.45%)
Mutual labels:  graphql, jest
Graphql Ts Server Boilerplate
A GraphQL server boilerplate made with Typescript, PostgreSQL, and Redis
Stars: ✭ 643 (+1361.36%)
Mutual labels:  graphql, postgresql
Next Right Now
Flexible production-grade boilerplate with Next.js 10, Vercel and TypeScript. Includes multiple opt-in presets using Storybook, Airtable, GraphQL, Analytics, CSS-in-JS, Monitoring, End-to-end testing, Internationalization, CI/CD and SaaS B2B multi single-tenancy (monorepo) support
Stars: ✭ 671 (+1425%)
Mutual labels:  graphql, jest
Tinder Clone
Fullstack Tinder app clone made with React/Ts/Nest
Stars: ✭ 43 (-2.27%)
Mutual labels:  graphql, postgresql

K2

K2

Build Status codecov Package dependencies Codacy Badge

Koa 2 and GraphQL server that just works™. We've climbed the mountain of boilerplate for you, so you don't have to.

Included…

  • koa2 - write stuff in middleware
  • babel - use latest ES6/7 features today. why wait?
  • passport.js - easy authentication
  • knex.js - documentation is better than sequelize
  • GraphQL - it's the way to go
  • Jest - don't let tests get in your way
  • ramda - please don't use lodash or underscore
  • prettier - don't worry about formatting…
  • flowtype - get your types right

Getting started

Make sure you have Docker installed as PostgreSQL is run on the docker container.

git clone -o k2 -b master --single-branch https://github.com/hongymagic/k2.git example-api

cd example-api                  # Change current directory to the newly created one
yarn install                    # Install required packages via yarn
cp .env.sample .env             # Configuration on development mode is done via dotenv
yarn migrate:latest             # Run database migrations
yarn seed:run                   # Add some seed data
yarn start:dev                  # Start the server in development mode

By default the API server starts on port 5000, http://localhost:5000.

Structure

┌── .env.sample                 # Sample .env file loaded into process.env
├── docker-compose.yml          # Auxiliary services such as postgresql via docker
├── knexfile.js                 # Configuration for knex.js
├── migrations/                 # Database migrations. See below for more info
├── seeds/                      # Database seeds. See below for more info
├── tests/                      # Integration tests using supertest
├── sqlite3/                    # SQLite3 database location
└── src/
    ├── db.js                   # DB instance used by the app and/or models
    ├── models/                 # ORM models written in ES6 classes
    ├── middleware/             # Custom middleware to be used by modules
    ├── modules/                # Route-Controller pair for koa2
    │   ├── auth/               # Sample /authenticate module
    │   ├── graphql/            # GraphQL
    │   └── index.js            # Don't touch this
    ├── passport.js             # Passport.js configuration using passport-local
    ├── DataLoader.js           # Data fetching layer for GraphQL
    ├── schema.js               # GraphQL schema
    └── types/                  # GraphQL types

Testing

K2 uses Facebook Jest so you can add a directory named __tests__ at any level and start writing tests.

Root level tests directory is reserved for integration tests using supertest. Currently requires you to run the database server via docker-compose: see above.

yarn test                 # Run all tests including unit and integration tests
yarn test:unit            # Only run unit tests inside src/ directory
yarn test:integration     # Only run integration tests inside tests/ directory
yarn test:coverage        # Generate coverage report. Also travis default

Deployments

This is a standard Node.js version 8.0+ application. You can deploy it to anywhere you like including, but not limited to:

Now.sh

Deploying to now is super simple if you're using SQLite3 (default). Just run:

now

AWS ElasticBeanstalk

Simply create a version of AWS EB with Node version 8.0.1 and deploy. I personally have travis CI deploy it via a eb script.

  • TODO: Sample .ebextensions/
  • Database is already configured to prefer RDS_{HOSTNAME,DB_NAME,USERNAME,PASSWORD} connection information
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].