{"id":13778955,"url":"https://github.com/hongymagic/k2","last_synced_at":"2026-01-05T19:56:29.732Z","repository":{"id":139896952,"uuid":"92170093","full_name":"hongymagic/k2","owner":"hongymagic","description":"Koa2 API template with passport, GraphQL, flowtype, knex and more.","archived":false,"fork":false,"pushed_at":"2018-03-26T19:11:57.000Z","size":729,"stargazers_count":50,"open_issues_count":31,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T08:26:06.928Z","etag":null,"topics":["flowtype","graphql","jest","knex","koa2","koa2-start","nodejs","passport","postgresql","starter-kit"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hongymagic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-23T12:25:29.000Z","updated_at":"2025-03-15T20:58:44.000Z","dependencies_parsed_at":"2024-01-07T00:08:19.367Z","dependency_job_id":null,"html_url":"https://github.com/hongymagic/k2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongymagic%2Fk2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongymagic%2Fk2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongymagic%2Fk2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongymagic%2Fk2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hongymagic","download_url":"https://codeload.github.com/hongymagic/k2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253567035,"owners_count":21928768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flowtype","graphql","jest","knex","koa2","koa2-start","nodejs","passport","postgresql","starter-kit"],"created_at":"2024-08-03T18:00:59.470Z","updated_at":"2026-01-05T19:56:29.704Z","avatar_url":"https://github.com/hongymagic.png","language":"JavaScript","funding_links":[],"categories":["Examples \u0026 Boilerplates"],"sub_categories":[],"readme":"![K2](https://gist.githubusercontent.com/hongymagic/44b775944afd136e2cafbde8868b7df2/raw/3edeb106a828b538808ecb7252112a5fedf62da9/logo.png)\n\n# K2\n\n[![Build Status](https://travis-ci.org/hongymagic/k2.svg?branch=master)](https://travis-ci.org/hongymagic/k2) [![codecov](https://codecov.io/gh/hongymagic/k2/branch/master/graph/badge.svg)](https://codecov.io/gh/hongymagic/k2) ![Package dependencies](https://david-dm.org/hongymagic/k2.svg) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b01ca9655eb54672910339f7f653ad93)](https://www.codacy.com/app/hongymagic-github/k2?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=hongymagic/k2\u0026amp;utm_campaign=Badge_Grade)\n\nKoa 2 and GraphQL server that _just works™_. We've climbed the mountain of\nboilerplate for you, so you don't have to.\n\n## Included…\n\n- [koa2](http://koajs.com) - write stuff in middleware\n- [babel](http://babeljs.io) - use latest ES6/7 features today. why wait?\n- [passport.js](http://passportjs.org) - easy authentication\n- [knex.js](http://knexjs.org) - documentation is better than sequelize\n- [GraphQL](http://graphql.org) - it's the way to go\n- [Jest](https://facebook.github.io/jest/) - don't let tests get in your way\n- [ramda](http://ramdajs.com) - please don't use lodash or underscore\n- [prettier](https://prettier.github.io/prettier/) - don't worry about formatting…\n- [flowtype](https://flow.org) - get your types right\n\n## Getting started\n\nMake sure you have Docker installed as PostgreSQL is run on the docker\ncontainer.\n\n```\ngit clone -o k2 -b master --single-branch https://github.com/hongymagic/k2.git example-api\n\ncd example-api                  # Change current directory to the newly created one\nyarn install                    # Install required packages via yarn\ncp .env.sample .env             # Configuration on development mode is done via dotenv\nyarn migrate:latest             # Run database migrations\nyarn seed:run                   # Add some seed data\nyarn start:dev                  # Start the server in development mode\n```\n\nBy default the API server starts on port 5000, http://localhost:5000.\n\n## Structure\n\n```\n┌── .env.sample                 # Sample .env file loaded into process.env\n├── docker-compose.yml          # Auxiliary services such as postgresql via docker\n├── knexfile.js                 # Configuration for knex.js\n├── migrations/                 # Database migrations. See below for more info\n├── seeds/                      # Database seeds. See below for more info\n├── tests/                      # Integration tests using supertest\n├── sqlite3/                    # SQLite3 database location\n└── src/\n    ├── db.js                   # DB instance used by the app and/or models\n    ├── models/                 # ORM models written in ES6 classes\n    ├── middleware/             # Custom middleware to be used by modules\n    ├── modules/                # Route-Controller pair for koa2\n    │   ├── auth/               # Sample /authenticate module\n    │   ├── graphql/            # GraphQL\n    │   └── index.js            # Don't touch this\n    ├── passport.js             # Passport.js configuration using passport-local\n    ├── DataLoader.js           # Data fetching layer for GraphQL\n    ├── schema.js               # GraphQL schema\n    └── types/                  # GraphQL types\n```\n\n## Testing\n\nK2 uses [Facebook Jest](https://facebook.github.io/jest/) so you can add a\ndirectory named `__tests__` at any level and start writing tests.\n\nRoot level `tests` directory is reserved for integration tests using supertest.\nCurrently requires you to run the database server via docker-compose: see above.\n\n```\nyarn test                 # Run all tests including unit and integration tests\nyarn test:unit            # Only run unit tests inside src/ directory\nyarn test:integration     # Only run integration tests inside tests/ directory\nyarn test:coverage        # Generate coverage report. Also travis default\n```\n\n## Deployments\n\nThis is a standard Node.js version 8.0+ application. You can deploy it to\nanywhere you like including, but not limited to:\n\n- [now.sh](https://zeit.co/now)\n- [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/)\n- Pretty much anything that runs docker or Node.js\n\n### Now.sh\n\nDeploying to now is super simple if you're using SQLite3 (default). Just run:\n\n```\nnow\n```\n\n### AWS ElasticBeanstalk\n\nSimply create a version of AWS EB with Node version 8.0.1 and deploy. I\npersonally have travis CI deploy it via a `eb` script.\n\n- TODO: Sample `.ebextensions/`\n- Database is already configured to prefer `RDS_{HOSTNAME,DB_NAME,USERNAME,PASSWORD}` connection information\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongymagic%2Fk2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhongymagic%2Fk2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongymagic%2Fk2/lists"}