{"id":29129611,"url":"https://github.com/startbootstrap/sb-clean-blog-node","last_synced_at":"2025-08-29T09:22:49.896Z","repository":{"id":42288726,"uuid":"241739568","full_name":"StartBootstrap/sb-clean-blog-node","owner":"StartBootstrap","description":"Open sourced Nodejs backend built with Typescript, Fastify, and TypeORM. ","archived":false,"fork":false,"pushed_at":"2023-01-05T09:41:02.000Z","size":1369,"stargazers_count":50,"open_issues_count":29,"forks_count":53,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T03:09:16.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://startbootstrap.com/themes/clean-blog-angular/","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/StartBootstrap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-19T22:23:26.000Z","updated_at":"2025-02-23T12:49:59.000Z","dependencies_parsed_at":"2023-02-03T23:16:24.911Z","dependency_job_id":null,"html_url":"https://github.com/StartBootstrap/sb-clean-blog-node","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/StartBootstrap/sb-clean-blog-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartBootstrap%2Fsb-clean-blog-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartBootstrap%2Fsb-clean-blog-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartBootstrap%2Fsb-clean-blog-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartBootstrap%2Fsb-clean-blog-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartBootstrap","download_url":"https://codeload.github.com/StartBootstrap/sb-clean-blog-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartBootstrap%2Fsb-clean-blog-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272659283,"owners_count":24971607,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-30T03:09:14.900Z","updated_at":"2025-08-29T09:22:49.874Z","avatar_url":"https://github.com/StartBootstrap.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SB Clean Blog Node\n\n[![Build Status](https://travis-ci.org/StartBootstrap/sb-clean-blog-node.svg?branch=master)](https://travis-ci.org/StartBootstrap/sb-clean-blog-node)\n\n## Links\n\n[Click here for the frontend.](https://github.com/StartBootstrap/sb-clean-blog-angular)\nBuilt with Angular\n\n[Click here to view Angular code coverage](https://sb-clean-blog.startbootstrap.com/coverage/sb-clean-blog-angular/index.html)\n\n[Click here to view Node code coverage](https://sb-clean-blog.startbootstrap.com/coverage/sb-clean-blog-node/index.html)\n\n\n## Prerequisites\n\nBefore you begin, make sure your development environment inlcudes the following technologies:\n\n### 1) Node.js\n\nWe recommend you use the latest LTS version of node, which is currently 12.x\n\nTo get node, go to [nodejs.org](http://nodejs.org)\n\nTo check your node version run the following in terminal:\n\n```bash\nnode --version\n```\n\n### 2) Postgres\n\nOur Chosen ORM in Node is TypeORM. [TypeORM suports most major databases](https://typeorm.io/#/connection-options)\n\nWe prefer the very popular and open source [postgres](https://www.postgresql.org).\n\nIf desiered it should be relatively trivial to switch databases.\n\n_Note: db scripts at `scripts/db/` have not been tested with any other databases besides postgres_\n\nTo get postgres, go to [postgresql.org](https://www.postgresql.org/download) or install via [homebrew](https://brew.sh/)\n\n_Note: If you install via homebrew, don't forget to run `brew services start postgresql`_\n\nTo check your postgres version run the following in terminal:\n\n```bash\npsql --version\n```\n\nTo set up a new user in postgres type the following in terminal (It will prompt you for a password):\n\n```bash\ncreateuser newuser --pwprompt --createdb # newuser can be any username you choose\n```\n\n#### _NOTE: Remember the username password you use here. You will need to add it into `.env`_\n\nTest that you can log in to postgres:\n\n```bash\npsql -U newuser template1\n```\n\nCommon postgres commands can be found in: [NOTES/POSTGRES.md](NOTES/POSTGRES.md)\n\n## Quick Start\n\n### Download the repo\n\n```bash\ngit clone git@github.com:startbootstrap/sb-clean-blog-node.git\ncd sb-clean-blog-node\n```\n\n### 1) Set up `.env`\n\n```bash\ncp .env.sample .env\n```\n\nOpen `.env` and change the values for:\n\n```bash\nDB_ROOT_USER_PASSWORD=CHANGE_ME__STRING # make up a password\nTYPE_ORM_USERNAME=CHANGE_ME__STRING # postgres username\nTYPE_ORM_PASSWORD=CHANGE_ME__STRING # postgres password\nJWT_SECRET=CHANGE_ME__STRING # make up a random string\n```\n\n### 2) Install dependencies\n\n```bash\nnpm install\n```\n\n### 3) Reset the database\n\nThis command:\n\n- drops the current database\n- recreates the databse\n- runs all migrations\n- creates the root user\n- seeds the db with random posts\n\n```bash\nnpm run db:reset # See the next command if you have issues with this command\n```\n\n#### If you receive an error `function uuid_generate_v4() does not exist` then run the command:\n\n```bash\nnpm run db:uuid\n```\n\nThis will add the extension `uuid-ossp` to the template1 databse.\n\nYou will then need to run `npm run db:reset` again\n\n### 4) Start the server\n\n```bash\nnpm start\n```\n\nYou should be able to hit \u003chttp://localhost:8200/api/latest/health\u003e\n\n### 5) Run the front end (sb-clean-blog-angular)\n\nFollow the README at [sb-clean-blog-angular](https://github.com/StartBootstrap/sb-clean-blog-angular)\n\n## Tests\n\nUnit Tests are named `*.test.ts` and are located in the same directory as the file they are testing.\n\n### Unit Tests\n\n```bash\nnpm run test\n\n# To keep the test runner going as you devleop tests use:\nnpm run test:watch\n```\n\nTo run a specific test, you can do:\n\n```bash\nnpm run test:one -- -t=[string]\n```\n\n#### View Coverage\n\n```bash\nnpm run serve:coverage\n```\n\n## Migrations\n\n```bash\n# typeOrm cli help\nnpm run cli -- -h\n\n# Create a migration\nnpm run db:migration:generate -- -n my-migration\n\n# Run migrations \nnpm run db:migration:run\n```\n\n## Docker\n\nSB Clean Blog Node comes with a Dockerfile and build scripts.\n\nYou can get Docker [here](https://www.docker.com/get-started)\n\n```bash\n# Be sure to build the app first\nnpm run build\n\n# Then build the docker image\nnpm run docker:build\n\n# Then run the image\nnpm run docker:run\n```\n\nIf you intend to use this in production, you will need to modify the run script:\n`scripts/docker/docker-run.ts` to change the .env variables to point to your production postgres instance.\n\nYou will also need to develop a way to initialize and run migrations on the production database.\nOne option is to set you local .env to temporarily point to your production database and run the commands locally.\n\n## Style\n\n### Lint Code\n\n```bash\nnpm run lint\n```\n\n### Fix all fixable lint errors\n\n```bash\nnpm run lint:fix\n```\n\n### Check if any tslint rules conflick with prettier\n\n```bash\nnpm run lint:check\n```\n\n## Debug \n\n### To run in debug mode\n\n```bash\nnpm run debug\n```\n\n### To debug tsonfig\n\n```bash\nnode_modules/.bin/tsc --showConfig -p ./src/tsconfig.app.json\nnode_modules/.bin/tsc --showConfig -p ./src/tsconfig.spec.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartbootstrap%2Fsb-clean-blog-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartbootstrap%2Fsb-clean-blog-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartbootstrap%2Fsb-clean-blog-node/lists"}