Use this readme to provide information around how to set up, run, test, and deploy your app.
- Install dependencies:
$ yarn
- Run a full-on app:
$ yarn dev
- Run tests:
$ yarn test
It's recommended to use Postgres, for both your development and test environments. If this sounds good to you, add the following dependencies:
$ yarn add pg pg-native
And uncomment the Postgres uri
configuration from each environment:
// recommended to use real postgres in development
// uri: process.env.POSTGRES_URL || `postgres://localhost:5432/${pkg.name}_development`,
uri: 'sqlite://src/config/db/app_development.sqlite'
Remember to create a postgres database in the name of your package (pkg.name
), or with another name you prefer.
Let's take a stroll around the main parts of your new app.
Take a look at:
- Environments: src/config/environments
- Database: src/config/db
- Test: jest.config.js
- Dependencies and scripts: package.json
Take a look at:
- Models: src/app/models
- Controllers: src/app/controllers
- Workers and Tasks: src/app/models, src/app/tasks
- Tests: src/test
Now that you're done, why not run a generator, see what it does?
Generate a model:
bin/hyperstack g model Post
And a controller:
bin/hyperstack g controller posts
You start with Hyperstack immediately in development because the development environment is configured to use sqlite
. You should, after feeling comfortable (or immediately), move to Postgres.
Although Hypermodel
supports what ever database sequelize
supports, we think a good all-arounder is just Postgres so we officially just support that. Redis is used for background jobs.
For development, you can use postgres.app or a postgres container, and a local Redis (brew install redis
) or a Redis container.
Of course, you can always wrap both your Postgres and Redis in a docker compose, you can start from this one
Your direct point of interest should be config/environments/test.ts because testing on a real Postgres is better than a toy sqlite db in development.
Your app is ready to run. Go to the Hyperstack website for docs and more.