{"id":22347245,"url":"https://github.com/dylants/nextjs-template","last_synced_at":"2026-04-11T03:08:34.788Z","repository":{"id":263678440,"uuid":"891139340","full_name":"dylants/nextjs-template","owner":"dylants","description":"A starter template for a Next.js application","archived":false,"fork":false,"pushed_at":"2025-01-24T18:04:20.000Z","size":436,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T19:19:37.845Z","etag":null,"topics":["authentication","integration-tests","middleware","nextjs","prisma","storybook","typescript"],"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/dylants.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}},"created_at":"2024-11-19T19:50:30.000Z","updated_at":"2025-01-24T18:04:23.000Z","dependencies_parsed_at":"2024-11-19T21:27:45.919Z","dependency_job_id":"1d8abeda-de04-4319-bae6-fdc1e48bbc52","html_url":"https://github.com/dylants/nextjs-template","commit_stats":null,"previous_names":["dylants/nextjs-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylants%2Fnextjs-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylants%2Fnextjs-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylants%2Fnextjs-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylants%2Fnextjs-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylants","download_url":"https://codeload.github.com/dylants/nextjs-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245641317,"owners_count":20648637,"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":["authentication","integration-tests","middleware","nextjs","prisma","storybook","typescript"],"created_at":"2024-12-04T10:08:35.395Z","updated_at":"2025-10-06T17:44:52.686Z","avatar_url":"https://github.com/dylants.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nextjs-template\n\nA template for a Next.js application\n\n## Getting Started\n\nUse [nvm](https://github.com/nvm-sh/nvm) to use the project's Node version\n\n```\nnvm use\n```\n\nInstall dependencies\n\n```\nnpm install\n```\n\n## Config\n\nConfiguration for the application is available within the [`src/config/index.ts`](src/config/index.ts) file. See the config file for configuration elements exposed via environment variables.\n\n## Database\n\nThis project utilizes [Prisma](https://www.prisma.io/) for its ORM, and expects a PostgreSQL database instance.\n\nThe database schema is stored in the [schema.prisma](prisma/schema.prisma) file.\n\n### Setup Postgres\n\nInstall PostgreSQL and populate the `.env.*` files with the correct `DATABASE_URL` string to connect to PostgreSQL.\n\nThe `DATABASE_URL` should be populated as such:\n\n```\nDATABASE_URL=\"postgresql://USER:PASSWORD@HOST:PORT/nextjs-template\"\n```\n\n### Run Migrations\n\nTo run migrations:\n\n```\nnpm run db:migrate\n```\n\n### Create New Migration\n\nTo create a new migration (and run it):\n\n```\nnpm run db:migrate --name \u003cmigration name\u003e\n```\n\n### Seeds\n\nDatabase seeds are found in the [seeds script directory](prisma/seeds/).\n\nTo run the script to generate seed data:\n\n```\nnpm run db:seed\n```\n\nReset the database, re-run migrations, and re-seed the database:\n\n```\nnpm run db:reset\n```\n\n#### Seed Configuration\n\nThe following environment variables are available to set specifics:\n\nNumber of Widgets to create (defaults to 10):\n\n```\nSEED_NUM_WIDGETS=10\n```\n\n## Run in production environment (Docker)\n\nThis application is designed to run in production using Docker. The following steps outline the process.\n\n### Build Docker Image\n\nTo build the Docker image:\n\n```\nnpm run prod:build\n```\n\nLogin to Github Container Registry with Personal Access Token (requires write)\n```\ndocker login ghcr.io -u \u003cusername\u003e\n\u003center token\u003e\n```\n\nPush the tagged image to GitHub Container Registry\n```\ndocker push ghcr.io/dylants/nextjs-template:\u003ctag\u003e\n```\n\n### Run Migrations\n\nRun the migrations on the production database:\n\n```\nnpm run prod:db:migrate\n```\n\n### Run Docker Container\n\nOn production machine:\n\nLogin to Github Container Registry with Personal Access Token (requires read)\n```\ndocker login ghcr.io -u \u003cusername\u003e\n\u003center token\u003e\n```\n\nPull the image:\n```\ndocker pull ghcr.io/dylants/nextjs-template:\u003ctag\u003e\n```\n\nDefine the environment variables in the `.env.production` file. See the [docker-compose.prod.yml](docker-compose.prod.yml) file for specifics.\n\nStart the app:\n```\nnpm run prod:up\n```\n\nStop the app:\n```\nnpm run prod:down\n```\n\n## Tests\n\n### Lint and Type Checking\n\nThis project is configured to use ESLint as the linter.\n\nTo run both lint and compile TypeScript files:\n\n```\nnpm run lint\n```\n\n### Unit Tests\n\nJest unit tests exist along side the source files.\n\nTo run the tests:\n\n```\nnpm test\n```\n\nTo run tests in watch mode:\n\n```\nnpm run test:watch\n```\n\n### Integration Tests\n\nIntegration tests exist in [`integration-tests`](integration-tests).\n\nThe integration tests require a test database. This is setup via Docker Compose, and requires a running Docker instance.\n\nTo run the tests:\n\n- Start Docker ([Docker Desktop](https://docs.docker.com/desktop/) is an easy option).\n\n- Start the test database\n\n```\nnpm run ci:up\n```\n\n- Migrate and seed the test database\n\n```\nnpm run ci:db:reset\n```\n\n- Run the tests\n\n```\nnpm run test:ci\n```\n\nTo run tests in watch mode:\n\n```\nnpm run test:ci:watch\n```\n\nWhen tests are complete, you can shutdown the test database:\n\n```\nnpm run ci:down\n```\n\n### Code Coverage\n\nTo run all the tests and include code coverage, follow the steps above for the specific test types. Then to run the tests:\n\n```\nnpm run test:coverage\n```\n\n## Storybook\n\nThis app uses [Storybook](https://storybook.js.org/) to demo UI components.\n\nTo run storybook:\n\n```\nnpm run storybook\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylants%2Fnextjs-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylants%2Fnextjs-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylants%2Fnextjs-template/lists"}