Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

A demo project that shows a fullstack ReasonML/OCaml app–native binary + webapp

License

NotificationsYou must be signed in to change notification settings

yawaramin/fullstack-reason

Repository files navigation

This project shows a minimal fullstackReasonML application. It has a

  • Backend web server that compiles to a native binary using the Esy/dunecompilation toolchain
  • Frontend ReasonReact component that compiles to JavaScript using theBuckleScript toolchain
  • Shared business logic used by both of the above

This is a proof-of-concept; you can customize it to your needs.

Try it out

Development mode

Follow these steps:

  1. InstallNodeJS (one-time setup)
  2. Install Esy (one-time setup):npm install --global esy@latest
  3. Set up the backend project:esy install (one-time setup but willtake a while to compile dependencies like SSL so grab your favouritebeverage)
  4. Runnpm install (or usepnpm to save somedisk space)
  5. Run the services defined inProcfile either manually on differentterminals, or using a process manager like Foreman/Overmind/Hivemind
  6. Browse the frontend:http://localhost:5200/

Production mode

You can also try out the app without the Webpack dev server:

  1. Assuming the above builds have already been done
  2. Put production assets in thedist directory:npm run dist
  3. Run the backend app:esy b dune exec backend/App.exe
  4. Browse the frontend (note, different port than above, this is beingserved directly from the backend app):http://localhost:8080/

Correctly caches the JS bundle–with cache busting!

How it works

This project pulls together:

Project layout

These are the significant parts of the project:

  • backend/: contains the sources for the backend executable
  • esy.lock/: a lock directory used by Esy to capture precise dependencyinformation
  • frontend/: contains the sources for the frontend ReasonReact app
  • shared/: contains sources shared between the backend and frontend
  • bsconfig.json: BuckleScript project configuration
  • dune-project:Dune project configuration (forthe native build)
  • esy.json: Esy project configuration (native package management)
  • fullstack-reason.opam:OPAM projectconfiguration (empty but needed for backward-compatibility with OPAM)
  • package.json:Npm project configuration
  • webpack.config.js:Webpack bundlerconfiguration for the frontend

Honourable mention: build outputs are in the.gitignore.

About

A demo project that shows a fullstack ReasonML/OCaml app–native binary + webapp

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp