-
Notifications
You must be signed in to change notification settings - Fork 69
#966 nextjs example template #1009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7afafb0
feat: initial commit for atomic Next.js template #966
RoelLeijser 499e1de
Add webpack extension alias for .js extentions in Next.js config
RoelLeijser c7da150
Refactor MenuItem component
RoelLeijser 64ff237
Add blog page
RoelLeijser e07aa22
Add CurrentSubjectContext with errors
RoelLeijser cebc6a1
Start migrating to server components (breaking)
RoelLeijser d2d550f
Upgrade next to v15
RoelLeijser 2c7d7d3
Update template to server components
RoelLeijser fff5d46
Migrate to ESLint v9
RoelLeijser 34afa40
Modified the Search functionality to server components with streaming
RoelLeijser 59f9754
Refactor for client side
RoelLeijser 21a1d1a
Implement feedback
RoelLeijser 21484e1
Update README.md
RoelLeijser e843c8e
Move store
RoelLeijser b9c6406
Enhance Next.js template
RoelLeijser e48c57f
Implement feedback and fixes
RoelLeijser efdfe2e
Add dynamic file extension handling in ontology index generation when…
RoelLeijser 946e35e
Add cli support for Next.js template
RoelLeijser 3a91cb9
Small fixes
RoelLeijser 8588357
Refactor CSS styles and update navbar
RoelLeijser 4cb927d
Refactor MenuItem components
RoelLeijser bd48294
Add deployment instructions for Netlify in README
RoelLeijser 98f4e6f
Refactor layout and context management
RoelLeijser 89bc8a0
Refactor MenuItem components and update dependencies
RoelLeijser 57a1d13
Add deployment instructions for Netlify and Vercel to README, remove …
RoelLeijser 851617f
Add nextjs-site template to documentation
RoelLeijser c5f23f1
Add e2e next template tests
RoelLeijser ca90f14
Add SvelteKit to templte e2e test
RoelLeijser 21816ce
Update e2e tests with fix for occupied ports
RoelLeijser 22a74b2
Fix tests
Polleps cb21e23
Next Template improvements #966
Polleps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.js | ||
| .yarn/install-state.gz | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # next.js | ||
| /.next/ | ||
| /out/ | ||
|
|
||
| # production | ||
| /build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # debug | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # local env files | ||
| .env*.local | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Atomic Next.js Template | ||
|
|
||
| This repository is a [Next.js](https://nextjs.org/) 15 website starter template to be used with [AtomicServer](https://github.com/atomicdata-dev/atomic-server). For specific steps on how to deploy this template, see [DEPLOYING](./README/deploying.md). | ||
|
|
||
| ## Getting started | ||
|
|
||
| This guide assumes you have AtomicServer running on your local machine. If you don't, you can follow the [AtomicServer installation guide](https://docs.atomicdata.dev/atomicserver/installation). | ||
|
|
||
| ### 1. Create a new project | ||
|
|
||
| ```bash | ||
| $ npm create @tomic/template my-project -- --template nextjs-site --server-url http://localhost:9883 | ||
| $ pnpm create @tomic/template my-project --template nextjs-site --server-url http://localhost:9883 | ||
| $ yarn create @tomic/template my-project --template nextjs-site --server-url http://localhost:9883 | ||
| ``` | ||
|
|
||
| ### 2. Generate ontologies | ||
|
|
||
| ```bash | ||
| $ cd my-project | ||
| ``` | ||
|
|
||
| ```bash | ||
| $ npx ad-generate ontologies | ||
| $ pnpm exec ad-generate ontologies | ||
| $ yarn ad-generate ontologies | ||
| ``` | ||
|
|
||
| After making changes to an ontology you need to re-generate them in your code. | ||
|
|
||
| ### 3. Start the development server | ||
|
|
||
| ```bash | ||
| $ npm run dev | ||
| $ pnpm dev | ||
| $ yarn dev | ||
| ``` | ||
|
|
||
| ## Structure | ||
|
|
||
| Atomic Data resources are rendered by views. | ||
| These views are components that accept a resource as prop and render the data in a certain way. | ||
| For example the `BlogPostFullPage` view renders a `blog-post` resource as a full page. | ||
|
|
||
| Oftentimes these views also come with a kind of view selector component that determines what component to render based on the resources class. | ||
| An example of this would be `FullPageView`. | ||
|
|
||
| These selector components are great for when a resource can reference another resource without a classtype, meaning it can be any kind of resource. | ||
| For example, the `page` class has a `blocks` property that can reference any type of resource. | ||
| The FullPage view for the `page` class (`PageFullPage`) therefore renders a `BlockView` component that selects the appropriate component to render, i.e. a `TextBlock` or an `ImageGalleryBlock`. | ||
|
|
||
| ## Deploying | ||
|
|
||
| ### Deploying to Netlify | ||
|
|
||
| #### Prerequisites | ||
|
|
||
| - A [Netlify](https://www.netlify.com/) account | ||
| - A Git repository with your template project | ||
|
|
||
| #### UI | ||
|
|
||
| 1. Click on the "Add new site" button and select "Import an existing project". | ||
| 2. Choose your Git provider and select the repository where your project is located. | ||
| 3. Add the environment variables required by your project | ||
|
|
||
| #### CLI | ||
|
|
||
| 1. Install the Netlify CLI by running `npm install -g netlify-cli`. | ||
| 2. Run `netlify login` and log in. | ||
| 3. Run `netlify init` and select the repository you want to deploy. | ||
| 4. Run `netlify deploy` to deploy the site. | ||
|
|
||
| ### Deploying to Vercel | ||
|
|
||
| #### Prerequisites | ||
|
|
||
| - A [Vercel](https://vercel.com/) account | ||
| - A Git repository with your template project | ||
|
|
||
| #### UI | ||
|
|
||
| 1. Click on the "Import Project" button and select the repository where your project is located. | ||
| 2. Add the environment variables required by your project. | ||
|
|
||
| #### CLI | ||
|
|
||
| 1. Install the Vercel CLI by running `npm install -g vercel`. | ||
| 2. Run `vercel login` and log in. | ||
| 3. Run `vercel` and select the repository you want to deploy. | ||
| 4. Run `vercel --prod` to deploy the site to production. | ||
|
|
||
| ## Resources | ||
|
|
||
| - [AtomicServer Docs](https://docs.atomicdata.dev/) | ||
| - [Next.js Docs](https://nextjs.org/docs) | ||
| - [Discord](https://discord.gg/a72Rv2P) |
4 changes: 4 additions & 0 deletions
4
browser/create-template/templates/nextjs-site/atomic.config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "outputFolder": "./src/ontologies", | ||
| "ontologies": ["<ONTOLOGY>"] | ||
| } |
10 changes: 10 additions & 0 deletions
10
browser/create-template/templates/nextjs-site/eslint.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { FlatCompat } from '@eslint/eslintrc'; | ||
|
|
||
| const compat = new FlatCompat(); | ||
|
|
||
| /** @type {import('eslint').ESLint.ConfigData} */ | ||
| const eslintConfig = [ | ||
| ...compat.extends('next/core-web-vitals', 'next/typescript'), | ||
| ]; | ||
|
|
||
| export default eslintConfig; |
12 changes: 12 additions & 0 deletions
12
browser/create-template/templates/nextjs-site/next.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| webpack: config => { | ||
| config.resolve.extensionAlias = { | ||
| '.js': ['.ts', '.tsx', '.js'], | ||
| }; | ||
|
|
||
| return config; | ||
| }, | ||
| }; | ||
|
|
||
| export default nextConfig; |
35 changes: 35 additions & 0 deletions
35
browser/create-template/templates/nextjs-site/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "nextjs-site", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "lint": "next lint", | ||
| "update-ontologies": "ad-generate ontologies" | ||
| }, | ||
| "dependencies": { | ||
| "@t3-oss/env-nextjs": "^0.11.1", | ||
| "@tomic/lib": "^0.40.0", | ||
| "@tomic/react": "^0.40.0", | ||
| "clsx": "^2.1.1", | ||
| "gray-matter": "^4.0.3", | ||
| "modern-css-reset": "^1.4.0", | ||
| "next": "15.0.4", | ||
| "react": "19.0.0", | ||
| "react-dom": "19.0.0", | ||
| "remark": "^15.0.1", | ||
RoelLeijser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "remark-html": "^16.0.1", | ||
| "zod": "^3.23.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@tomic/cli": "^0.40.0", | ||
| "@types/node": "^20", | ||
| "@types/react": "19.0.1", | ||
| "@types/react-dom": "19.0.1", | ||
| "eslint": "^9.13.0", | ||
| "eslint-config-next": "15.0.2", | ||
| "typescript": "^5" | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.