Our Koa starter kit
This project aims at being a "starter kit" for the apps we develop everyday at Mostaza.
We've been parse-server users since its first open source release and we enjoyed it a lot so far, but at the same time we've always looked for more customizable alternative with a smaller footprint, hence we started working on this repo.
Warning: Still a work in progress.
N.B.: A feature should be checked as done only when paired with failing and working tests.
Middlewares:
- Secured routes from unauthenticated access -
middlewares/ensureAuthenticated
- Handled parameters validation -
koa-bouncer
- Handled cross domain requests -
middlewares/allowCrossDomain
- Handled errors -
middlewares/errorHandler
Authentication using session tokens (parse-server docet):
- Signup -
POST /auth/signup
- Login -
POST /auth/login
- Logout -
POST /auth/logout
- Email Verification -
GET /auth/verify
- Password reset email request -
POST /auth/forgot
- Password reset page -
GET /auth/reset
- Password reset handling -
POST /auth/reset
User routes
- Get authenticated user -
GET /user
Entities CRUD:
- Message: get all -
GET /messages
- Message: get by id -
GET /messages/:id
- Message: create -
POST /messages
- Message: patch -
PATCH /messages/:id
- Message: delete -
DELETE /messages/:id
- ...other
Utilities:
- Simple logging (not in TEST)
You must have Postgres installed. I recommend http://postgresapp.com/ for OSX.
git clone git@github.com:themostaza/koa-starter.git
cd koa-starter
touch .env
yarn install
yarn run start-dev
> Server is listening on http://localhost:3000...
Create a .env
file in the root directory which will let you set environment variables. yarn run start-dev
will read from it.
Example .env
:
DATABASE_URL=postgres://username:password@localhost:5432/my-database
MAIL_FROM_ADDRESS=info@themostaza.com
MANDRILL_API_KEY=secret-api-key
HTML_VERIFY_EMAIL_SUCCESS_PATH=./public_html/verify_email_success.html
HTML_PASSWORD_UPDATE_REQUEST_PATH=./public_html/password_update_request.html
HTML_PASSWORD_UPDATE_SUCCESS_PATH=./public_html/password_update_success.html
We are grateful to the authors of existing related projects for their ideas and collaboration: