diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/.env b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/.env index 424129fe..64f779ae 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/.env @@ -8,8 +8,11 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service. DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..9c8e1c1b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/docker-compose.yaml @@ -0,0 +1,33 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/.env b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/.env index 424129fe..64f779ae 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/.env @@ -8,8 +8,11 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service. DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..218a9215 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: toor + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/.env b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/.env index e052a27f..c7ac2175 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/yonodeDB'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/yonodeDB' where 'db' is the name of the database service. DATABASE_URL= # Authentication and Security Configuration @@ -22,4 +24,4 @@ JWT_SECRET_KEY= # This setting can influence the application's behavior, enabling or disabling certain features based on the environment. # For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling. # Default: development (if not specified) -NODE_ENVIRONMENT= +NODE_ENVIRONMENT= \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/Dockerfile new file mode 100644 index 00000000..644e007b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..218a9215 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: toor + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/package.json b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/package.json index f0b1b75f..ee39c47c 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/package.json +++ b/packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/package.json @@ -22,11 +22,11 @@ "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", "mongoose": "^8.3.4", - "morgan": "^1.10.0" + "morgan": "^1.10.0", + "prisma": "^5.13.0" }, "devDependencies": { "nodemon": "^3.1.0", - "yonode": "^1.2.3", - "prisma": "^5.13.0" + "yonode": "^1.2.3" } } diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/.env b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/.env index 51b37125..c7ac2175 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/.env @@ -7,8 +7,9 @@ SERVER_PORT= # Database Configuration # ---------------------- -# Provide the URL for connecting to the database, This should include the protocol, username, password, host, port, and database name as applicable. -# Format: protocol://username:password@host:port/databaseName +# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/yonodeDB'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/yonodeDB' where 'db' is the name of the database service. DATABASE_URL= # Authentication and Security Configuration @@ -23,4 +24,4 @@ JWT_SECRET_KEY= # This setting can influence the application's behavior, enabling or disabling certain features based on the environment. # For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling. # Default: development (if not specified) -NODE_ENVIRONMENT= +NODE_ENVIRONMENT= \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..644e007b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..218a9215 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: toor + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/.env b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/.env index 23679d0c..64f779ae 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/.env @@ -8,8 +8,11 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service. DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB @@ -27,4 +30,4 @@ JWT_SECRET_KEY= # This setting can influence the application's behavior, enabling or disabling certain features based on the environment. # For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling. # Default: development (if not specified) -NODE_ENVIRONMENT= +NODE_ENVIRONMENT= \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..218a9215 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: toor + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/config/dbConfig.js b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/config/dbConfig.js index 6372201a..c57d0702 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/config/dbConfig.js +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/config/dbConfig.js @@ -10,6 +10,7 @@ const AppDataSource = new DataSource({ database: dbName, entities: [User], synchronize: true, + authSource: "admin" }); AppDataSource.initialize() diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/.env b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/.env index 424129fe..64f779ae 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/.env @@ -8,8 +8,11 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mongodb://root:example@localhost:27017/'. +# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service. DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..218a9215 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + db: + image: mongo:latest + container_name: mongo-db + ports: + - '27017:27017' + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: toor + restart: on-failure + # healthcheck: + # test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet + # interval: 10s + # timeout: 5s + # retries: 5 + + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db + \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/config/dbConfig.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/config/dbConfig.js index fd690071..a4cae0f2 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/config/dbConfig.js +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/config/dbConfig.js @@ -9,6 +9,7 @@ const AppDataSource = new DataSource({ database: dbName, entities: ["../entity/**/*.js"], synchronize: true, + authSource: "admin" }); AppDataSource.initialize() diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.env b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.env index e052a27f..63cc0c14 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mysql://username:password@localhost:5432/database'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@mysql-db:5432/database' where 'db' is the name of the database service. DATABASE_URL= # Authentication and Security Configuration diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.gitignore b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.gitignore index d1bc7cb0..fba2dc9e 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.gitignore +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/Dockerfile new file mode 100644 index 00000000..644e007b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..83f84c88 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/docker-compose.yaml @@ -0,0 +1,32 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + ports: + - '5431:5432' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: root + volumes: + - ./db:/var/lib/mysql + restart: on-failure + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/package.json b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/package.json index f0b1b75f..ee39c47c 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-Prisma-Auth-Template/package.json @@ -22,11 +22,11 @@ "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", "mongoose": "^8.3.4", - "morgan": "^1.10.0" + "morgan": "^1.10.0", + "prisma": "^5.13.0" }, "devDependencies": { "nodemon": "^3.1.0", - "yonode": "^1.2.3", - "prisma": "^5.13.0" + "yonode": "^1.2.3" } } diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.env b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.env index 51b37125..50c5f781 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.env @@ -8,10 +8,10 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database, This should include the protocol, username, password, host, port, and database name as applicable. -# Format: protocol://username:password@host:port/databaseName +# For example, 'mysql://username:password@localhost:5432/database'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@mysql-db:5432/database' where 'db' is the name of the database service. DATABASE_URL= -# Authentication and Security Configuration # ----------------------------------------- # Define a secret key for JWT (JSON Web Token) authentication. This key is used to sign and verify JWTs for secure data transfer and access control. # The JWT_SECRET_KEY should be a long, random string that is kept secure to ensure token integrity and prevent unauthorized access. diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.gitignore b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.gitignore index d1bc7cb0..d49f6fa0 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.gitignore +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..644e007b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..83f84c88 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,32 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + ports: + - '5431:5432' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: root + volumes: + - ./db:/var/lib/mysql + restart: on-failure + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/.env b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/.env index 23679d0c..801ed548 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mysql://username:password@localhost:5432/'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@db:3306/' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..92f4e600 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/docker-compose.yaml @@ -0,0 +1,42 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + volumes: + - ./db-data:/var/lib/mysql + ports: + - '3306:3306' + - '33060:33060' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: 123321 + MYSQL_DATABASE: yonodeDB + MYSQL_ROOT_HOST: "%" + restart: on-failure + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 30s + timeout: 3s + retries: 10 + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_NAME: ${DATABASE_NAME} + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + db: + condition: service_healthy \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/app.js b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/app.js index 0f75df63..dba382fa 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/app.js +++ b/packages/yonode-templates/JS-MySQL-Sequelize-Auth-Template/src/app.js @@ -58,4 +58,4 @@ connectDB(); // Server running app.listen(port, () => { console.log(`${chalk.green.bold("Server")} is listening on port ${port}`); -}); \ No newline at end of file +}); diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/.env b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/.env index ae7f2e21..801ed548 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/.env @@ -3,17 +3,20 @@ # Specify the port number on which the server will listen for incoming connections. # If not specified, the default port 8000 will be used. # Default: 8000 -SERVER_PORT=8000 +SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. -# mysql://root:@localhost:3306/ -DATABASE_URL= +# For example, 'mysql://username:password@localhost:5432/'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@db:3306/' where 'db' is the name of the database service. +DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB DATABASE_NAME= + # Authentication and Security Configuration # ----------------------------------------- # Define a secret key for JWT (JSON Web Token) authentication. This key is used to sign and verify JWTs for secure data transfer and access control. diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..92f4e600 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,42 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + volumes: + - ./db-data:/var/lib/mysql + ports: + - '3306:3306' + - '33060:33060' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: 123321 + MYSQL_DATABASE: yonodeDB + MYSQL_ROOT_HOST: "%" + restart: on-failure + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 30s + timeout: 3s + retries: 10 + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_NAME: ${DATABASE_NAME} + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + db: + condition: service_healthy \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package-lock.json b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package-lock.json index 792d2912..8587d221 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package-lock.json +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package-lock.json @@ -27,7 +27,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "nodemon": "^3.1.1", + "nodemon": "^3.1.0", "yonode": "^1.2.3" } }, @@ -1804,9 +1804,9 @@ } }, "node_modules/nodemon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz", - "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", + "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", "dev": true, "dependencies": { "chokidar": "^3.5.2", diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json index d6810936..9c2219d9 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json @@ -28,7 +28,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "nodemon": "^3.1.1", + "nodemon": "^3.1.0", "yonode": "^1.2.3" } } diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/.env b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/.env index 23679d0c..801ed548 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mysql://username:password@localhost:5432/'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@db:3306/' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..92f4e600 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/docker-compose.yaml @@ -0,0 +1,42 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + volumes: + - ./db-data:/var/lib/mysql + ports: + - '3306:3306' + - '33060:33060' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: 123321 + MYSQL_DATABASE: yonodeDB + MYSQL_ROOT_HOST: "%" + restart: on-failure + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 30s + timeout: 3s + retries: 10 + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_NAME: ${DATABASE_NAME} + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + db: + condition: service_healthy \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/package.json b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/package.json index a3f2d8d6..d1032e8f 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-TypeORM-Auth-Template/package.json @@ -20,7 +20,6 @@ "express-validator": "^7.0.1", "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", - "mysql": "^2.18.1", "mysql2": "^3.9.7", "morgan": "^1.10.0", "reflect-metadata": "^0.2.2", diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/.env b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/.env index 424129fe..801ed548 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'mysql://username:password@localhost:5432/'. +# If you are using docker-compose, the database URL should be 'mysql://username:password@db:3306/' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. @@ -27,4 +29,4 @@ JWT_SECRET_KEY= # This setting can influence the application's behavior, enabling or disabling certain features based on the environment. # For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling. # Default: development (if not specified) -NODE_ENVIRONMENT= \ No newline at end of file +NODE_ENVIRONMENT= diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..92f4e600 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,42 @@ +version: '3.9' + +services: + db: + image: mysql:latest + container_name: mysql-db + volumes: + - ./db-data:/var/lib/mysql + ports: + - '3306:3306' + - '33060:33060' + environment: + MYSQL_USER: yonode + MYSQL_PASSWORD: 123321 + MYSQL_ROOT_PASSWORD: 123321 + MYSQL_DATABASE: yonodeDB + MYSQL_ROOT_HOST: "%" + restart: on-failure + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 30s + timeout: 3s + retries: 10 + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_NAME: ${DATABASE_NAME} + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + db: + condition: service_healthy \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json index 4c3d660d..31061a96 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json @@ -21,7 +21,6 @@ "chalk": "5.3.0", "compression": "^1.7.4", "morgan": "^1.10.0", - "mysql": "^2.18.1", "mysql2": "^3.9.7", "helmet": "^7.1.0", "nodemailer": "^6.9.13", diff --git a/packages/yonode-templates/JS-NoDB-Template/Dockerfile b/packages/yonode-templates/JS-NoDB-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-NoDB-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-NoDB-Template/README.md b/packages/yonode-templates/JS-NoDB-Template/README.md index cfe9881d..c82594b2 100644 --- a/packages/yonode-templates/JS-NoDB-Template/README.md +++ b/packages/yonode-templates/JS-NoDB-Template/README.md @@ -23,3 +23,14 @@ The server is running and ready to serve requests. Now, Go to the Src directory and start building the server. Happy coding! + + +## NOTES + +### Using Docker + +To use Docker, you do not need to install `node_modules` locally. Simply run the following command: + +```bash +docker-compose up +``` \ No newline at end of file diff --git a/packages/yonode-templates/JS-NoDB-Template/docker-compose.yaml b/packages/yonode-templates/JS-NoDB-Template/docker-compose.yaml new file mode 100644 index 00000000..e0f5a63e --- /dev/null +++ b/packages/yonode-templates/JS-NoDB-Template/docker-compose.yaml @@ -0,0 +1,12 @@ +version: '3.9' + +services: + server: + build: . + container_name: server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.env index e052a27f..b824fefa 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'postgresql://username:password@localhost:5432/database'. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432/database' where 'db' is the name of the database service. DATABASE_URL= # Authentication and Security Configuration diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.gitignore index d1bc7cb0..b4611886 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/.gitignore @@ -47,3 +47,6 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/Dockerfile new file mode 100644 index 00000000..644e007b --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/README.md b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/README.md index 620c9efb..4179b143 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/README.md +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/README.md @@ -23,3 +23,14 @@ The server is running and ready to serve requests. Now, Go to the Src directory and start building the server. Happy coding! + + +## NOTES + +### Using Docker + +To use Docker, you do not need to install `node_modules` locally. Simply run the following command: + +```bash +docker-compose up +``` \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..71186f1d --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-Auth-Template/docker-compose.yaml @@ -0,0 +1,31 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.env index 51b37125..ca4ca8ee 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.env @@ -7,16 +7,11 @@ SERVER_PORT= # Database Configuration # ---------------------- -# Provide the URL for connecting to the database, This should include the protocol, username, password, host, port, and database name as applicable. -# Format: protocol://username:password@host:port/databaseName +# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'postgresql://username:password@localhost:5432/database'. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432/database' where 'db' is the name of the database service. DATABASE_URL= -# Authentication and Security Configuration -# ----------------------------------------- -# Define a secret key for JWT (JSON Web Token) authentication. This key is used to sign and verify JWTs for secure data transfer and access control. -# The JWT_SECRET_KEY should be a long, random string that is kept secure to ensure token integrity and prevent unauthorized access. -JWT_SECRET_KEY= - # Application Environment # ----------------------- # Set the environment in which the Node.js application is running. Common values are 'development', 'production', and 'test'. diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.gitignore index f3ff251a..21618d69 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4baf7430 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/Dockerfile @@ -0,0 +1,17 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN pnpm install + +RUN npm install -g nodemon + +RUN npx prisma generate + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..769afc52 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,30 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure + + server: + build: . + container_name: yonode-server + restart: on-failure + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + DATABASE_URL: ${DATABASE_URL} + SERVER_PORT: ${SERVER_PORT} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.env index 23679d0c..aeaa1bac 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'postgres://username:password@hostname:port'. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.gitignore index d1bc7cb0..fba2dc9e 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..361304c1 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-Auth-Template/docker-compose.yaml @@ -0,0 +1,32 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure:5 + + server: + build: . + container_name: yonode-server + restart: on-failure:5 + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + SERVER_PORT: ${SERVER_PORT} + DATABASE_URL: ${DATABASE_URL} + DATABASE_NAME: ${DATABASE_NAME} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.env index 424129fe..14fbc9f5 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.env @@ -8,6 +8,8 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# For example, 'postgres://username:password@hostname:port'. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. @@ -15,16 +17,10 @@ DATABASE_URL= # Default: yonodeDB DATABASE_NAME= -# Authentication and Security Configuration -# ----------------------------------------- -# Define a secret key for JWT (JSON Web Token) authentication. This key is used to sign and verify JWTs for secure data transfer and access control. -# The JWT_SECRET_KEY should be a long, random string that is kept secure to ensure token integrity and prevent unauthorized access. -JWT_SECRET_KEY= - # Application Environment # ----------------------- # Set the environment in which the Node.js application is running. Common values are 'development', 'production', and 'test'. # This setting can influence the application's behavior, enabling or disabling certain features based on the environment. # For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling. # Default: development (if not specified) -NODE_ENVIRONMENT= \ No newline at end of file +NODE_ENVIRONMENT= diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.gitignore index d1bc7cb0..fba2dc9e 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..764af9f3 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,31 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure:5 + + server: + build: . + container_name: yonode-server + restart: on-failure:5 + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + SERVER_PORT: ${SERVER_PORT} + DATABASE_URL: ${DATABASE_URL} + DATABASE_NAME: ${DATABASE_NAME} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js index 28deb3c9..66a5c47f 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -1,8 +1,8 @@ import express from "express" import { helloWorld } from "../controllers/helloWorldController.js" -const helloWorldRouter = express.Router() +const hellWorldRouter = express.Router() -helloWorldRouter.get("/" , helloWorld) +hellWorldRouter.get("/" , helloWorld) -export default helloWorldRouter; +export default hellWorldRouter; diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.env index 23679d0c..19bdcf96 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.env @@ -8,6 +8,7 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432' where 'db' is the name of the database service. DATABASE_URL= # Specify the name of the database to which the application will connect. diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.gitignore index d1bc7cb0..fba2dc9e 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/docker-compose.yaml new file mode 100644 index 00000000..361304c1 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-Auth-Template/docker-compose.yaml @@ -0,0 +1,32 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure:5 + + server: + build: . + container_name: yonode-server + restart: on-failure:5 + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + SERVER_PORT: ${SERVER_PORT} + DATABASE_URL: ${DATABASE_URL} + DATABASE_NAME: ${DATABASE_NAME} + JWT_SECRET_KEY: ${JWT_SECRET_KEY} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.env b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.env index 424129fe..6f7d20cd 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.env +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.env @@ -8,19 +8,15 @@ SERVER_PORT= # Database Configuration # ---------------------- # Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable. +# If you are using docker-compose, the database URL should be 'postgresql://username:password@postgres-db:5432' where 'db' is the name of the database service. DATABASE_URL= + # Specify the name of the database to which the application will connect. # If not specified, the default database 'yonodeDB' will be used. # Default: yonodeDB DATABASE_NAME= -# Authentication and Security Configuration -# ----------------------------------------- -# Define a secret key for JWT (JSON Web Token) authentication. This key is used to sign and verify JWTs for secure data transfer and access control. -# The JWT_SECRET_KEY should be a long, random string that is kept secure to ensure token integrity and prevent unauthorized access. -JWT_SECRET_KEY= - # Application Environment # ----------------------- # Set the environment in which the Node.js application is running. Common values are 'development', 'production', and 'test'. diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.gitignore b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.gitignore index d1bc7cb0..fba2dc9e 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.gitignore +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/.gitignore @@ -47,3 +47,5 @@ Thumbs.db # Miscellaneous .node_repl_history .vscode-test + +db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/Dockerfile b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/Dockerfile new file mode 100644 index 00000000..4032ca3b --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/Dockerfile @@ -0,0 +1,15 @@ +FROM node:21 + +EXPOSE 8000 + +WORKDIR /app + +COPY . . + +RUN npm install -g pnpm + +RUN npm install -g nodemon + +RUN pnpm install + +CMD ["nodemon", "-L", "./src/app.js"] \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/docker-compose.yaml b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/docker-compose.yaml new file mode 100644 index 00000000..764af9f3 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/docker-compose.yaml @@ -0,0 +1,31 @@ +version: '3.9' + +services: + db: + image: postgres:latest + container_name: postgres-db + ports: + - '5431:5432' + environment: + POSTGRES_USER: yonode + POSTGRES_PASSWORD: 123321 + volumes: + - ./db:/var/lib/postgresql/data + restart: on-failure:5 + + server: + build: . + container_name: yonode-server + restart: on-failure:5 + volumes: + - .:/app + - /app/node_modules + ports: + - '8000:8000' + environment: + SERVER_PORT: ${SERVER_PORT} + DATABASE_URL: ${DATABASE_URL} + DATABASE_NAME: ${DATABASE_NAME} + NODE_ENVIRONMENT: ${NODE_ENVIRONMENT} + depends_on: + - db \ No newline at end of file diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package-lock.json b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package-lock.json index 8e07d77b..c9ee414c 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package-lock.json +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package-lock.json @@ -28,7 +28,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "nodemon": "^3.1.1", + "nodemon": "^3.1.0", "yonode": "^1.2.3" } }, @@ -2057,9 +2057,9 @@ } }, "node_modules/nodemon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz", - "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", + "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", "dev": true, "dependencies": { "chokidar": "^3.5.2", diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json index 88cf4714..848bd4e0 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json @@ -30,6 +30,6 @@ }, "devDependencies": { "yonode": "^1.2.3", - "nodemon": "^3.1.1" + "nodemon": "^3.1.0" } } diff --git a/packages/yonode/package.json b/packages/yonode/package.json index 5febf488..665eb168 100644 --- a/packages/yonode/package.json +++ b/packages/yonode/package.json @@ -1,7 +1,7 @@ { "name": "yonode", "description": "The Node.js Toolkit for Rapid Development.", - "version": "1.2.4", + "version": "1.2.3", "author": "Mr Sharafdin", "license": "MIT", "main": "./src/index.js",