0xcadams / accelerate-starter

An opinionated universal web app + API starter kit to facilitate rapid and scalable development using NextJS, FeathersJS, and MongoDB.
https://accelerate-starter.vercel.app/
MIT License
3 stars 2 forks source link
commitizen cypress feathersjs lerna node now react-hooks redux redux-saga semantic-ui-react typescript

An opinionated universal web app + API starter kit to facilitate rapid and scalable development using NextJS, FeathersJS, and MongoDB.

Accelerate is a starter project to enable a team to quickly jump past common hurdles such as user authentication, password resets, unit and integration tests, CI/CD, and tooling to begin solving their core business problems.

Web
NextJS, React, React Redux, Redux Saga, Material UI, and Babel
API
FeathersJS, Mongoose, Nodemon, Express, and Winston
Testing
Cypress, Mocha, Enzyme, Chai.
Tooling
Typescript, TSLint (Based on Airbnb), Prettier, Lerna, Commitizen, and Commitlint
Hosting
Zeit Now

[![Uptime Robot](https://img.shields.io/uptimerobot/ratio/m782175114-036d055bce99279de3d423f5.svg)](https://stats.uptimerobot.com/49G0WUOLW) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://lbesson.mit-license.org/)

Getting Started

First, start the MongoDB database using Docker.

docker run --name accelerate-mongo -d -p 27017:27017 mongo

Then, bring up both the web app and API by running:

yarn install
yarn start

This will use lerna to start each service in the packages/ folder.

Web

Also, one can start the web app individually by running:

cd packages/web/
yarn install
yarn start

The web interface is built on NextJS. To learn more about it, visit nextjs.org.

API

Similarly, start the API individually by running:

cd packages/api/
yarn install
yarn start

To learn more about Feathers, visit feathersjs.com or jump right into the Feathers docs.

Project Structure

Further design decisions/walkthrough of project structure is under coming soon...

now secret add accelerate-starter-stage_authentication-secret "*****"
now secret add accelerate-starter-prod_authentication-secret  "*****"

now secret add accelerate-starter-stage_mongodb-url "mongodb+srv://***"
now secret add accelerate-starter-prod_mongodb-url "mongodb+srv://***"

now secret add accelerate-starter-stage_sendgrid-api-key "SG.****"
now secret add accelerate-starter-prod_sendgrid-api-key "SG.****"

now dns add accelerate-starter.com '@' MX mx1.forwardemail.net 10
now dns add accelerate-starter.com '@' MX mx2.forwardemail.net 20
now dns add accelerate-starter.com '@' TXT forward-email=c@cadams.io
now dns add accelerate-starter.com '@' TXT "v=spf1 a mx include:spf.forwardemail.net -all"

Design Decisions

A few points about the cool consequences of decisions made in the design of this project:

Shared Types: Since Typescript is used on the frontend and backend, types are shared across applications via the @lieuu/core module. This means that the contract remains strongly typed and consistent between the API and consumers.

REST Endpoints: The API uses FeathersJS as its backbone - this enables a user to write minimal code to wire Express to make RESTful endpoints - simply add a model, define a new FeathersJS service, and it handles the creation of CRUD operations on that resource. This greatly reduces boilerplate code that needs to be maintained.

NextJS: The frontend is based upon NextJS, which includes a lot of opinion by default. This again reduces the amount of boilerplate code which needs to be maintained - Webpack configuration is minimal, development/building/deployment is easy, and documentation is great.

Automated Tests: The end-to-end tests using Cypress are easy to modify and automatically run against each deployment to ZEIT Now. A comment is left on a PR with a link to the deployment, and the build will fail if the deployment does not pass end-to-end tests. This means significantly less maintenance of a single "staging" environment, but n number of "staging" environments with automated tests to reduce QA overhead.

License

Licensed under the MIT license.