Editorial is a blog and editor interface for my personal website. It's powered by Next.js, Recoil, rich-markdown-editor and more.
It is still under development and doesn't work as intended yet.
Features
- Persistence — Persists all changes locally and syncs with backend service to save changes remotely frequently.
- Block-based Markdown Editor — The editor is powered by outline/rich-markdown-editor and provides a fast way to write posts, using markdown under the hood.
More features will be added in the future.
Development
Editorial uses Next.js with Prisma and Nexus for the GraphQL service.
git clone https://github.com/fnky/editorial.git
cd editorial
yarn
yarn setup
Setup Postgres database
For development, you can use Docker to create a development database.
Run the following command in the project directory to create and run new Postgres container in detached mode:
docker compose up -d
You can stop and remove the container with the down
command.
By default the PostgreSQL is setup with the following credentials:
Username: meerkat
Password: wonderland
Database: editorial
This is set in .env
, however you can override it by creating a .env.local
file with a custom DATABASE_URL
environment variable.
All data is saved to a pgdata
folder, which allows you to restore the data
across containers at any time.
Migrations
When changing the prisma/schema.prisma
file you can push the state of the
schema to the database during prototyping:
yarn prisma db push --preview-feature
To create a migration, run the following commands:
# Generate type definitions and run migrations
yarn generate
yarn db:migrate
To reset the database and apply migrations, run:
yarn db:reset
You can run yarn db:seed
to seed the database with some fake data at any time,
during development.
Note: Using Prisma CLI currently doesn't work with project's
tsconfig.json
for seeding, use the npm scripts instead. See prisma/#5718
Resources
- Upgrading Nexus Prisma to Nexus - Still a bit outdated, but useful for the most part.
- Nexus Plugin Prisma example project - Useful for some setup and troubleshooting.