The app uses:
- Postgres for the database
- trpc for the API layer
- knex for queries
- Vite for development and Vitest for testing
- Tailwind for styling
- Cypress for End to End and Component Testing
- Vue.js with the Composition API and
<script setup>
for the syntax - Express for the HTTP server
This project just uses plain old npm
. Clone it and run npm install
. You'll also need to create a database.
The schema is managed with knex.
- Create a database (by default we assume your database is called notifier_test).
- You can run
createdb notifier_test
to create, anddropdb notifier_test
to delete it).
- You can run
- Update
knexfile.js
with your credentials. - Run
npm run db:migrate
to run the migrations.
The development process is managed by Gulp. You only need to run npx gulp dev
to get started. You may need some environment variables, depending on how you configured your database, etc:
NODE_ENV=development POSTGRES_DB=notifier_test POSTGRES_PASSWORD=<password> POSTGRES_USER=lachlan npx gulp dev
If you need to add a new table or modify an exist one, do so via a migration.
- Run
npm db:make <name>
- Example:
npx knex migrate:make addOrganizationTable
- Fill out the
up
anddown
migrations - Write a test for both!
See here for an example. You should use the testMigration
function.
import { expect } from "vitest";
import { testMigration } from "./utils";
testMigration("20221220105733_addOrganizationTable", (verify) => {
verify.up(async (client) => {
// verify update works
});
verify.down(async (client) => {
// verify rollback works
});
});
- Run the Cypress End to End test with
npm run test:e2e
. - Run the Node.js tests (eg, migrations etc) with
npm run test:component
- Run the Component tests with
npm run test:unit
- Build the server and frontend with
npm run build
. - To start the server,
cd src/server
and runNODE_ENV=production POSTGRES_USER=<user> POSTGRES_PASSWORD=<password> EMAIL_USER=<user> EMAIL_PASSWORD=<password> node express.js
.