/remix-tutorial-awilix-mikro

This project is to test mikro-orm with remix using awilix for dependency injection. The project is not meant to be production ready but merely a POC using the remix tutorial as a demo.

Primary LanguageTypeScript

Remixing MikroOrm with Dependency Injection

This project is to test mikro-orm with remix using awilix for dependency injection. The project is not meant to be production ready but merely a POC using the remix tutorial as a demo.

Remix is in the process of developing middleware. Until this implemented this project uses the remix-express-vite-plugin to create a custom express server with middleware. The dependency injection container is injected into the route context using this middleware.

Getting started

  1. run the following to install all your dependencies
npm install
  1. run to following to create the first migration
npm mikro-orm migration:create
  1. run the following to create the database and apply the migration
npm mikro-orm migration:up
  1. seed the database
npm mikro-orm seeder:run

Development

From your terminal:

npm run dev

This starts your app in development mode, rebuilding assets on file changes.

Deployment

First, build your app for production:

npm run build

Then run the app in production mode:

npm start

Now you'll need to pick a host to deploy it to.

DIY

If you're familiar with deploying node applications, the built-in Remix app server is production-ready.

Make sure to deploy the output of remix build

  • build/server
  • build/client