diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03642d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.devenv +.devenv.flake.nix +.idea \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Engine.iml b/.idea/Engine.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/Engine.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..4cfa67d --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7a71c51 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..afbe93f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index df41f68..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Engine - -The Void Engine :3 (very cool name, and stuff) - -(This is for a secret project I'm working on :3) \ No newline at end of file diff --git a/apps/backend/README.md b/apps/backend/README.md new file mode 100644 index 0000000..5404a84 --- /dev/null +++ b/apps/backend/README.md @@ -0,0 +1,58 @@ +

+ 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 Bun framework for building efficient and scalable server-side applications.

+

+NPM Version +Package License +NPM Downloads +CircleCI +Coverage +Discord +Backers on Open Collective +Sponsors on Open Collective + + Support us + +

+ + +## Description + +[Nest](https://github.com/nestjs/nest) framework TypeScript repository with Bun. + +## Installation + +```bash +$ bun install +``` + +## Running the app + +```bash +# watch mode +$ bun run start:dev + +# production mode +$ bun run start:prod +``` + +## 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://kamilmysliwiec.com) +- Website - [https://nestjs.com](https://nestjs.com/) +- Twitter - [@nestframework](https://twitter.com/nestframework) +- Bun adaption - [@letstri](https://github.com/letstri) + +## License + +Nest is [MIT licensed](LICENSE). diff --git a/apps/backend/bun.lockb b/apps/backend/bun.lockb new file mode 100755 index 0000000..35f405d Binary files /dev/null and b/apps/backend/bun.lockb differ diff --git a/apps/backend/nest-cli.json b/apps/backend/nest-cli.json new file mode 100644 index 0000000..f9aa683 --- /dev/null +++ b/apps/backend/nest-cli.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true + } +} diff --git a/apps/backend/package.json b/apps/backend/package.json new file mode 100644 index 0000000..da69ca7 --- /dev/null +++ b/apps/backend/package.json @@ -0,0 +1,36 @@ +{ + "name": "homespace-backend", + "version": "0.0.1", + "author": "Johannes Reckers", + "type": "module", + "license": "MIT", + "scripts": { + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "start:dev": "bun --watch ./src/main.ts", + "start:debug": "nest start --debug --watch", + "start:prod": "bun ./src/main.ts", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" + }, + "dependencies": { + "@nestjs/common": "^10.0.0", + "@nestjs/core": "^10.0.0", + "@nestjs/platform-express": "^10.0.0", + "@nestjs/typeorm": "^10.0.1", + "mongodb": "^6.7.0", + "pg": "^8.11.3", + "typeorm": "^0.3.17" + }, + "devDependencies": { + "@nestjs/cli": "^10.0.0", + "@nestjs/schematics": "^10.0.0", + "@types/express": "^4.17.17", + "@types/node": "^20.9.4", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", + "eslint": "^8.42.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.0", + "prettier": "^3.0.0", + "typescript": "^5.1.3" + } +} \ No newline at end of file diff --git a/apps/backend/src/app.controller.ts b/apps/backend/src/app.controller.ts new file mode 100644 index 0000000..ae7af0a --- /dev/null +++ b/apps/backend/src/app.controller.ts @@ -0,0 +1,12 @@ +import { Controller, Get } from '@nestjs/common'; +import { AppService } from './app.service'; + +@Controller() +export class AppController { + constructor(private readonly appService: AppService) {} + + @Get() + createUser() { + return this.appService.createUser(); + } +} diff --git a/apps/backend/src/app.module.ts b/apps/backend/src/app.module.ts new file mode 100644 index 0000000..7c9a4e6 --- /dev/null +++ b/apps/backend/src/app.module.ts @@ -0,0 +1,27 @@ +import { Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; +import { User } from './entities/user.entity'; + +const userForFeature = TypeOrmModule.forFeature([User]); + +@Module({ + imports: [ + TypeOrmModule.forRoot({ + type: "mongodb", + host: "localhost", + port: 27017, + username: "homespace", + password: "homespace", + database: "homespace", + synchronize: true, + logging: false, + entities: [User], + }), + userForFeature, + ], + controllers: [AppController], + providers: [AppService], +}) +export class AppModule {} diff --git a/apps/backend/src/app.service.ts b/apps/backend/src/app.service.ts new file mode 100644 index 0000000..58a6ac5 --- /dev/null +++ b/apps/backend/src/app.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import type { Repository } from 'typeorm'; +import { User } from './entities/user.entity'; + +@Injectable() +export class AppService { + constructor( + @InjectRepository(User) + private readonly userRepository: Repository, + ) {} + + async createUser() { + const user = this.userRepository.create({ + firstName: 'Johannes', + lastName: 'Reckers', + age: 18, + }); + + const entity = await this.userRepository.save(user); + return entity; + } +} diff --git a/apps/backend/src/common/plugins/plugin.interface.ts b/apps/backend/src/common/plugins/plugin.interface.ts new file mode 100644 index 0000000..ffe1d28 --- /dev/null +++ b/apps/backend/src/common/plugins/plugin.interface.ts @@ -0,0 +1,3 @@ +export interface Plugin { + register(): void +} \ No newline at end of file diff --git a/apps/backend/src/common/plugins/plugin.service.ts b/apps/backend/src/common/plugins/plugin.service.ts new file mode 100644 index 0000000..77be46c --- /dev/null +++ b/apps/backend/src/common/plugins/plugin.service.ts @@ -0,0 +1,15 @@ +import { Injectable, OnModuleInit } from "@nestjs/common"; +import { type Plugin } from './plugin.interface'; + +@Injectable() +export class PluginService implements OnModuleInit { + private plugins: Plugin[] = []; + + public registerPlugin(plugin: Plugin) { + this.plugins.push(plugin); + } + + onModuleInit() { + this.plugins.forEach((plugin) => plugin.register()); + } +} \ No newline at end of file diff --git a/apps/backend/src/entities/user.entity.ts b/apps/backend/src/entities/user.entity.ts new file mode 100644 index 0000000..cdfe015 --- /dev/null +++ b/apps/backend/src/entities/user.entity.ts @@ -0,0 +1,16 @@ +import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'; + +@Entity() +export class User { + @PrimaryGeneratedColumn() + id: number; + + @Column() + firstName: string; + + @Column() + lastName: string; + + @Column() + age: number; +} diff --git a/apps/backend/src/main.ts b/apps/backend/src/main.ts new file mode 100644 index 0000000..3fb330f --- /dev/null +++ b/apps/backend/src/main.ts @@ -0,0 +1,14 @@ +import { NestFactory } from '@nestjs/core'; +import { AppModule } from './app.module'; +import { PluginService } from './common/plugins/plugin.service'; + +async function bootstrap() { + const app = await NestFactory.create(AppModule); + + const pluginService = app.get(PluginService); + pluginService.onModuleInit(); // Initialize plugins + + await app.listen(4300); +} + +bootstrap(); diff --git a/apps/backend/tsconfig.build.json b/apps/backend/tsconfig.build.json new file mode 100644 index 0000000..64f86c6 --- /dev/null +++ b/apps/backend/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] +} diff --git a/apps/backend/tsconfig.json b/apps/backend/tsconfig.json new file mode 100644 index 0000000..95f5641 --- /dev/null +++ b/apps/backend/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "ES2021", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true, + "skipLibCheck": true, + "strictNullChecks": false, + "noImplicitAny": false, + "strictBindCallApply": false, + "forceConsistentCasingInFileNames": false, + "noFallthroughCasesInSwitch": false + } +} diff --git a/apps/frontend/package.json b/apps/frontend/package.json new file mode 100644 index 0000000..1417fef --- /dev/null +++ b/apps/frontend/package.json @@ -0,0 +1,4 @@ +{ + "name": "homespace-frontend", + "version": "0.0.1" +} \ No newline at end of file diff --git a/apps/frontend/src/main.js b/apps/frontend/src/main.js new file mode 100644 index 0000000..e69de29 diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..b2dbe57 Binary files /dev/null and b/bun.lockb differ diff --git a/custom/plugins/blmedia-example/apps/frontend/src/main.js b/custom/plugins/blmedia-example/apps/frontend/src/main.js new file mode 100644 index 0000000..e69de29 diff --git a/custom/plugins/blmedia-example/blmedia-example.plugin.ts b/custom/plugins/blmedia-example/blmedia-example.plugin.ts new file mode 100644 index 0000000..fab40f0 --- /dev/null +++ b/custom/plugins/blmedia-example/blmedia-example.plugin.ts @@ -0,0 +1 @@ +// Todo: create example plugin \ No newline at end of file diff --git a/custom/plugins/blmedia-example/package.json b/custom/plugins/blmedia-example/package.json new file mode 100644 index 0000000..7add712 --- /dev/null +++ b/custom/plugins/blmedia-example/package.json @@ -0,0 +1,7 @@ +{ + "name": "blmedia-example", + "version": "0.0.1", + "workspaces": [ + "apps/*" + ] +} \ No newline at end of file diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..8c3467b --- /dev/null +++ b/devenv.lock @@ -0,0 +1,122 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1719323427, + "owner": "cachix", + "repo": "devenv", + "rev": "f810f8d8cb4e674d7e635107510bcbbabaa755a3", + "treeHash": "165ad401b1788985cdaa07483f9ed110cc848958", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716977621, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1719234068, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "90bd1b26e23760742fdcb6152369919098f05417", + "treeHash": "c87db871f241e42f31db9fb9936b61cb60f127ae", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1719259945, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", + "treeHash": "1a76ff89a9d4017b48abbb1bad8837b35d604ffc", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..3a095ee --- /dev/null +++ b/devenv.nix @@ -0,0 +1,15 @@ +{ pkgs, config, ... }: { + env.GREET = "Welcome to your dev environment <3\nNestJS + Bun"; + + packages = [ + pkgs.nest-cli + pkgs.bun + ]; + + enterShell = '' + echo "Installing packages" + bun i + clear + echo "${config.env.GREET}" + ''; +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8fd020b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +services: + homespace: + build: + context: ./ + dockerfile: Dockerfile + ports: + - "4300:4300" + restart: always + + mongo: + image: mongo + container_name: homespace-db + ports: + - "27017:27017" + restart: always + logging: + driver: "json-file" + options: + max-size: 1g + environment: + - MONGO_INITDB_ROOT_USERNAME=homespace + - MONGO_INITDB_ROOT_PASSWORD=homespace \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..b0c5370 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "homespace", + "private": true, + "workspaces": [ + "apps/*" + ] +} \ No newline at end of file