Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/getlarge/node-sea-demo
A demo for Node.js SEA
https://github.com/getlarge/node-sea-demo
docker esbuild fastify nodejs nx single-executable
Last synced: 29 days ago
JSON representation
A demo for Node.js SEA
- Host: GitHub
- URL: https://github.com/getlarge/node-sea-demo
- Owner: getlarge
- Created: 2024-11-13T08:45:46.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-27T21:12:50.000Z (29 days ago)
- Last Synced: 2024-11-27T22:22:14.579Z (29 days ago)
- Topics: docker, esbuild, fastify, nodejs, nx, single-executable
- Language: TypeScript
- Homepage:
- Size: 200 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NodeSeaDemo
![Cover](https://s3.amazonaws.com/media-p.slid.es/uploads/2597861/images/11768513/pasted-from-clipboard.png)
NodeSeaDemo is a practical demonstration of a [Single Executable Application](https://nodejs.org/api/single-executable-applications.html) (SEA) built with Node.js and Fastify. This project showcases how to handle file management during compilation, bundling, and runtime in a SEA context.
The application is compiled and bundled with ESBuild before the creation of the blob.
## Features
- **HTTP API**: A simple HTTP API built with Fastify.
- **Static Assets**: Handles bundled static assets.
- **File Uploads**: Supports dynamic file uploads.
- **SEA Assets**: Manages SEA assets.## Project Structure
- **apps/node-sea-demo**: Main application source code.
- **apps/node-sea-demo-e2e**: End-to-end tests for the application.
- **dist**: Compiled output directory.
- **Dockerfile**: Docker configuration for running the application.
- **Dockerfile.sea**: Docker configuration for building the SEA bundle.## Getting Started
### Prerequisites
- Node.js >= 20.12.0
- Docker### Installation
1. Clone the repository:
```sh
git clone https://github.com/your-repo/node-sea-demo.git
cd node-sea-demo
```2. Install dependencies:
```sh
npm install```
### Running the Application
To run the application locally:
```sh
nx run node-sea-demo:serve
```To build and run the SEA:
```sh
nx run node-sea-demo:sea-build
./dist/apps/node-sea-demo-sea/node
```To build and run the Docker container:
```sh
nx run node-sea-demo:docker-sea-build
docker run --rm -p 3000:3000 -t node-sea-demo:sea
```### Learn More
For more details, refer to the [presentation](https://slides.com/edouard_maleix/building-single-executable-applications-with-node-js).