Nest Logo

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 [circleci-url]: https://circleci.com/gh/nestjs/nest

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

## Centralized Configuration & Data This service uses a single SQLite database for all settings and configuration, located at: ``` /data/config.db ``` All persistent settings, file records, and configuration are stored in this database. This ensures a single source of truth for the backend API, CLI, and web apps. If you move or rename the database, update the path in `src/db.service.ts` and any other relevant locations. ## WebSocket Support This service includes WebSocket support for real-time communication with the web interface. The WebSocket server runs on the same port as the HTTP server. ### Events The service emits the following WebSocket events: - `taskUpdate`: Emitted when task status changes - `fileUpdate`: Emitted when files are added, changed, or removed by the watcher - `watcherUpdate`: Emitted when the file watcher starts, stops, or encounters errors ### Client Connection Web clients can connect using Socket.IO client: ```javascript import { io } from 'socket.io-client'; const socket = io('http://localhost:3000'); // Listen for events socket.on('fileUpdate', (data) => { console.log('File update:', data); }); socket.on('watcherUpdate', (data) => { console.log('Watcher update:', data); }); ``` ### Room Support Clients can join/leave rooms for targeted messaging: ```javascript // Join a room socket.emit('join', { room: 'dashboard' }); // Leave a room socket.emit('leave', { room: 'dashboard' }); ``` --- [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. ## Project setup ```bash $ pnpm install ``` ## Compile and run the project ```bash # development $ pnpm run start # watch mode $ pnpm run start:dev # production mode $ pnpm run start:prod ``` ## Run tests ```bash # unit tests $ pnpm run test # e2e tests $ pnpm run test:e2e # test coverage $ pnpm run test:cov ``` ## Deployment When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: ```bash $ pnpm install -g @nestjs/mau $ mau deploy ``` With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. ## Resources Check out a few resources that may come in handy when working with NestJS: - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). ## Support Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). ## Stay in touch - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) - Website - [https://nestjs.com](https://nestjs.com/) - Twitter - [@nestframework](https://twitter.com/nestframework) ## License Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). # Watch Finished API Service A modern NestJS API for managing files, settings, watcher, and tasks, all backed by a unified SQLite database. ## API Overview - **Base URL:** `http://localhost:3000` - **Authentication:** None (local network only by default) ## Main Endpoints - `GET /files` — List available datasets - `POST /files/:dataset/:file` — Create file record - `POST /files/:dataset/:file/update` — Update file record - `GET /files/:dataset/:file` — Get file record - `DELETE /files/:dataset/:file` — Delete file record - `GET /files/:dataset/status/:status` — List files by status - `GET /files/:dataset/deleted-older-than/:isoDate` — List deleted files older than date - `POST /files/expire` — Delete expired files - `POST /files/migrate` — Migrate legacy JSON to SQLite - `GET /config/settings` — Get all settings - `GET /config/settings?key=...` — Get setting by key - `POST /config/settings` — Update setting - `DELETE /config/settings/:key` — Delete setting - `GET /watcher/status` — Get watcher status - `POST /watcher/start` — Start watcher - `POST /watcher/stop` — Stop watcher - `GET /tasks` — List tasks - `POST /tasks` — Create task - `DELETE /tasks/:id` — Delete task - `GET /` — API root - `GET /ready` — Readiness probe - `GET /health` — Health check ## Database Structure - **settings**: All config and datasets (JSON) - **files**: All file records - **task**: Task queue and progress ## API Flow (MermaidJS) ```mermaid flowchart TD A[Client (Web/CLI)] -->|REST| B(API Service) B -->|SQL| C[(SQLite database)] B --> D[Watcher] B --> E[HandBrake] B --> F[Maintenance] ``` ## Example: File CRUD ```http POST /files/movies/myfile.mp4 { "output": "output.mp4", "status": "success", "date": "2025-12-30T12:00:00Z" } ``` ## Error Handling - All endpoints return JSON - 4xx for client errors, 5xx for server errors --- See [../docs/README.md](../docs/README.md) for full project documentation.