octet-stream/eri
Minimalistic open source blog engine
eri
Minimalistic open source blog engine.
This project built with React Router, Hono, Mikro ORM, Better Auth, Tailwind CSS and shadcn/ui.
Database schema setup
As the project is currently in prototyping stage, the only way to create database schema is to run pnpm mikro-orm-esm schema:update -r command.
This approach will be replaced with migrations.
Environment variables
Eri automatically picks up .env files from one of this souces: .env.<mode>.local, .env.<mode>, .env.local, .env (where mode is the value of the process.env.NODE_ENV).
If none of these exists, then Eri will fallback to process.env object.
Development setup
There's two ways to set up the project for local development: You can either install dependencies manually on your machine, or you can use Devcontainers
Devenv (Nix)
Before you begin, you'll need to install Nix and devenv following their instructions.
Optionally you can install direnv
- Activate shell either via:
- Direnv:
direnv allow - Devenv:
devenv shell
- Direnv:
- Start MariaDB server:
devenv up- this will start services in the foreground. If you wish run services in the background, use-dflag like this:devenv up -d - To start dev server, run following command:
pnpm dev
If you wish to stop services, run devenv processes down
Devcontainers
You can run development environment in devcontainers using following steps:
- Install Devcontainers extension to your VSCode
- Once you've installed, you'll be prompted to "Reopen the folter in a container" or you can clone the repository in Docker volume for better I/O performance. If you're not prompted, then open command palette and choose "Dev Containers: Open Folder in Container" command.
This will setup Nix and start development shell with devenv.
Note that .devcontainers.json is generated by devenv, so don't update it directly.
Alternatively you can use Devcontainers CLI. For that you'll need:
- Install the CLI;
- Open the project's root in your terminal;
- Run the
devcontainer up --workspace-folder .command. This will spin up a docker container for local development. Note that to install dependencies and run npm scripts (via pnpm) you'll need to use Devcontainer CLI.
Check out VSCode documentation to learn more: https://code.visualstudio.com/docs/devcontainers/containers
Manual setup
- First of all, you'll need to install MariaDB;
- Then clone this repository
git clone git@github.com:octet-stream/eri.git; - When it's done, install dependencies using
pnpm installcommand; - Create either
.env.development.localor.env.localand add required configuration; - Now you are able to run dev server. To do so, run
pnpm devcommand; - Open http://localhost:5173/admin and create admin account (if it doesn't exists).
Production preview
- Create either
.env.production.localor.env.localand add required configuration; - To build the project, run
pnpm build - Once production build is finished, run
pnpm start - Open http://localhost:3000/admin and create admin account (if it doesn't exists).
Demo
You can run demo application with non-persistent database in just a few steps:
- Create
.env.demo.localfile and fill it with required parameters - Run
pnpm demo.startcommand - Open http://localhost:3000/admin to create admin account
Note that the demo lives in-memory, so when use stop it via pnpm demo.stop command you'll loose the data from this demo.
Commands
List of available commands. These commands are accessible via pnpm.
| Name | Description |
|---|---|
build |
Builds project for production |
start |
Starts production server |
dev |
Starts Vite in dev mode |
dev.open |
Starts Vite in dev mode and opens app in user's default browser |
demo.start |
Starts docker container with demo application. If you want to rebuild the app's image, run this command with --build flag |
demo.stop |
Stops demo application and removed container |
lint.types |
Runs tsc to validate TypeScript types |