{"id":19170964,"url":"https://github.com/peter-gy/snip-man","last_synced_at":"2025-05-07T15:53:14.046Z","repository":{"id":39375807,"uuid":"467996517","full_name":"peter-gy/snip-man","owner":"peter-gy","description":"💻 A full-stack, dual-db code snippet manager. Purposefully overengineered to demonstrate certain architectural patterns.","archived":false,"fork":false,"pushed_at":"2025-04-02T08:26:57.000Z","size":5677,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T00:38:10.053Z","etag":null,"topics":["docker","docker-compose","full-stack","layered-architecture","mongodb","monorepo","multi-prisma","nestjs","nextjs","nginx","nx","postgres","prisma","snippets-manager"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-gy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-09T16:00:59.000Z","updated_at":"2025-04-02T08:27:01.000Z","dependencies_parsed_at":"2025-04-20T00:31:06.121Z","dependency_job_id":"a3d2590c-a521-4b3a-8947-ada681d2c476","html_url":"https://github.com/peter-gy/snip-man","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-gy%2Fsnip-man","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-gy%2Fsnip-man/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-gy%2Fsnip-man/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-gy%2Fsnip-man/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-gy","download_url":"https://codeload.github.com/peter-gy/snip-man/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912033,"owners_count":21824059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","full-stack","layered-architecture","mongodb","monorepo","multi-prisma","nestjs","nextjs","nginx","nx","postgres","prisma","snippets-manager"],"created_at":"2024-11-09T09:55:37.712Z","updated_at":"2025-05-07T15:53:14.013Z","avatar_url":"https://github.com/peter-gy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnipMan\n\nThis project was generated using [Nx](https://nx.dev).\n\n\u003cp style=\"text-align: center;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png\" width=\"450\" alt=\"NX Logo\"\u003e\u003c/p\u003e\n\n🔎 **Smart, Fast and Extensible Build System**\n\n**Table of contents**\n\n- [Development Environment Setup](#development-environment)\n- [Production Build \u0026 Run](#production-build--run)\n- [Working with `nx`](#working-with-nx)\n\n## One-liner App Start\n\n```shell\ndocker build . -t snip-man:nx-base \u0026\u0026 docker-compose up --build\n```\n\nThe app start might take up to 10-15 minutes based on your internet connection and your machine's performance. The\nsystem will be fully functional, once `snip-man-prisma-migrate` exits with code `0`. Please note that it is possible\nthat `snip-man-prisma-migrate` will exit with code `1` first, indicating an error, but this will be the case iff the\nmongo replica set `snip-man-mongo` starts up too slow. The system will self-heal automatically, you should just wait\nuntil you see `snip-man-prisma-migrate exited with code 0` in your logs.\n\nYou will be able to access the app via `https://localhost`. You will need to accept the self-signed certificates, or\nignore them in your browser. Both of the urls below need to be accessible by your browser:\n\n- `https://localhost`\n- `https://localhost:8443/api-docs/`\n\n## Development Environment\n\nThe development environment of this project is fully dockerized via `Dockerfile.dev` and `docker-compose.dev.yml`. The\nsetup makes it possible to edit the source files locally and run the `nx` commands inside a docker container. In\naddition, the database services can be also managed via `docker-compose`.\n\nSteps to start the development environment:\n\n1. Build and run the services: `make dev-up`\n2. Start Nx services of your choice (scripts in `package.json` might be helpful)\n\nNote that the repository root gets mounted bi-directionally into the `/usr/snip-man-dev/` directory of the `nx-dev`\nservice, therefore file-system changes made on the host will be immediately present inside the container, and\nvice-versa.\n\nThe `web` and `server` components can be served in development mode at once by executing `npm run project:serve`.\n\n### Truly Local Development\n\nInstall node modules:\n\n```shell\nnpm install\n```\n\nStart the database instances with Docker and serve the project from your local machine:\n\n```shell\nmake dev-up-local\n```\n\nThe following services will be started:\n\n- `postgres`: `localhost:15432`\n- `mongo`: `localhost:37017`\n- `server`: `localhost:3333`\n- `web`: `localhost:4200`\n\n## Production Build \u0026 Run\n\nThe system can be built using Docker only:\n\n1. Build the base `nx` image:\n\n```shell\ndocker build . -t snip-man:nx-base\n```\n\nNote that this base image containing the whole repository source is necessary for the build to succeed,\nas `nx` needs access to the whole monorepo to do shared module transpilation and more advanced dependency-graph based\ndependency resolution.\n\n2. Build the Docker services:\n\n```shell\ndocker-compose build\n```\n\nThe full system can be started by executing:\n\n```shell\ndocker-compose up\n```\n\n**Convenience command to execute the steps above at once:**\n\nUsing pure `bash`:\n\n```shell\ndocker build . -t snip-man:nx-base \u0026\u0026 docker-compose build \u0026\u0026 docker-compose up -d\n```\n\nUsing `make`:\n\n```shell\nmake prod-up\n```\n\n### Accessing App Components\n\nOnly the `web` and `server` components are exposed publicly. They can be accessed both with and without using SSL.\nPlease note that self-signed SSL certificates are generated upon container startup, hence your browser will complain\nabout security risks when visiting any of the below HTTPS links.\n\n- `web`:\n  - [http://localhost](http://localhost)\n  - [https://localhost](https://localhost)\n- `server`:\n  - [http://localhost:3333/api](http://localhost:3333/api)\n  - [https://localhost:8443/api](https://localhost:8443/api)\n\nPlease note that it is necessary to ignore SSL certificate errors with browsers when visiting the above links.\n\n- `macOS`, `Chromium`: `open /Applications/Chromium.app --args --ignore-certificate-errors`\n- `Windows`, `Chrome`: using flag `--ignore-certificate-errors`\n\n![helper](https://easywebfixes.com/wp-content/uploads/2018/08/ignore-certificate-errors-google-chrome.png)\n\n## Working with `nx`\n\n### Serving Project `web`\n\nIn order to serve the `Next` application, residing in `./apps/web`, execute:\n\n```shell\nnpx nx run web:serve\n```\n\nThe app should be accessible under http://localhost:4200.\n\n### Serving Project `server`\n\nIn order to serve the `Nest` application, residing in `./apps/server`, execute:\n\n```shell\nnpx nx run server:serve\n```\n\nThe app should be accessible under http://localhost:3333/api.\n\n### Parallel Serve\n\nIn order to execute both the `Next` and `Nest` applications, execute:\n\n```shell\nnpx nx run-many --target=serve --projects=web,server\n```\n\n### Formatting the Whole Project\n\nThe whole project source code can be formatted by executing:\n\n```shell\nnpx nx format:write\n```\n\n### Understand your workspace\n\nRun `nx graph` to see a diagram of the dependencies of your projects.\n\n### Further help\n\nVisit the [Nx Documentation](https://nx.dev) to learn more.\n\n### ☁ Nx Cloud\n\n#### Distributed Computation Caching \u0026 Distributed Task Execution\n\n\u003cp style=\"text-align: center;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png\" alt=\"NX Cloud Card\"\u003e\u003c/p\u003e\n\nNx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that\nare new to Nx can connect to Nx Cloud and start saving time instantly.\n\nTeams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s\nadvanced code generation and project dependency graph, plus a unified experience for both frontend and backend\ndevelopers.\n\nVisit [Nx Cloud](https://nx.app/) to learn more.\n\n## Working With Prisma\n\n### Useful links\n\n- [Prisma Schema](https://pris.ly/d/prisma-schema)\n- [Data Modelling](https://javascript.plainenglish.io/data-modeling-with-prisma-5c4c37f31d8c)\n\n### Generating Code\n\nGenerate `TypeScript` clients:\n\n```shell\nnpm run generate:prisma\n```\n\nGenerate `SQL`:\n\n```shell\nnpm run migrate:prisma\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-gy%2Fsnip-man","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-gy%2Fsnip-man","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-gy%2Fsnip-man/lists"}