This is a small example of using create-react-app, express, and express-session together and storing session data in Postgres.
This uses docker
and docker-compose
to manage a Postgres cluster and run migrations using db-mate.
After you clone the repo, you should run the setup
script:
yarn setup
This will do a number of things, like generate a .env
file and prompt for passwords, start the Postgres cluster in docker, run migrations, and generate TS types from the database using zapatos.
After that's done, you can start the project with:
yarn start
- settings page
- client-side protected routes
- server-side rendering?
I've specifically not done a lot of organization on the server, route handlers are crammed full of logic that should likely be separated, but I've deliberately kept it this way to keep the implementation simple and easy to understand. Consider separating the database calls into their own module, and using zod to validate form responses.