This starter template is crafted to help developers build and deploy applications using Next.js, Replicache, and EdgeDB.
This starter template is crafted to help developers build and deploy applications using Next.js, Replicache, and EdgeDB. It includes essential functionalities for real-time collaboration with offline capabilities and a ready-to-use API setup.
This project implements Replicache's "reset strategy" for data synchronization and conflict resolution.
For more details on the reset strategy and other synchronization approaches with Replicache, visit the synchronization strategies overview on their documentation site.
This project follows a structured approach typical of Next.js applications with additional directories specific to Replicache and EdgeDB:
.βββ app # Next.js pages and componentsβ βββ api # API routesβ β βββ pull # Pull endpoint for Replicacheβ β β βββ route.tsβ β βββ push # Push endpoint for Replicacheβ β βββ route.tsβ βββ components # React componentsβ β βββ TodoList.tsx # Todo list componentβ βββ favicon.ico # Faviconβ βββ globals.css # Global CSS stylesβ βββ layout.tsx # Layout componentβ βββ page.tsx # Entry point for the appβββ dbschema # EdgeDB schema filesβ βββ default.esdl # EdgeDB schema definitionβ βββ migrations # Schema migrationsβββ lib # Library functions and componentsβ βββ edgedb.ts # EdgeDB client configurationβ βββ mutators.ts # Replicache mutator functionsβ βββ types.ts # TypeScript types for the projectβββ public # Static assets like images and fontsβββ edgedb.toml # EdgeDB configuration fileβββ eslint.config.js # ESLint configurationβββ next-env.d.ts # Next.js typesβββ next.config.js # Next.js configurationβββ package.json # NPM dependencies and scriptsβββ pnpm-lock.yaml # pnpm lockfileβββ postcss.config.js # PostCSS configurationβββ README.md # Project READMEβββ tailwind.config.ts # Tailwind CSS configurationβββ tsconfig.json # TypeScript configuration
git clone https://github.com/edgedb/nextjs-replicache-edgedb-starter.gitcd nextjs-replicache-edgedb-starter
pnpm install # or npm install or yarn install
Run the EdgeDB project initialization:
npx edgedb project init
Create a .env.local
file in the root directory and add the following environment variables:
NEXT_PUBLIC_REPLICACHE_LICENSE_KEY = "your-replicache-license-key"
You can get your Replicache license key by running:
npx replicache@latest get-license
Replace the Replicache key in the page.tsx
file with your license key.
const replicache = new Replicache({name: userID,- licenseKey: TEST_LICENSE_KEY,+ licenseKey: process.env.NEXT_PUBLIC_REPLICACHE_LICENSE_KEY,mutators: { createTodo, updateTodo, deleteTodo },puller: pull,});
pnpm dev # or npm run dev or yarn dev
Open http://localhost:3000 with your browser to see the app.
Adjust the schema in dbschema/default.esdl
to meet your application's needs. For example, add new types or extend existing ones with additional properties.
Modify data fetching logic in the lib directory to enhance or alter how data interacts between the client and the database.
Update the global CSS styles in app/globals.css
or add new styles using Tailwind CSS utility classes.
Deploy your application to production using Vercel:
This starter template is crafted to help developers build and deploy applications using Next.js, Replicache, and EdgeDB.
This starter template is crafted to help developers build and deploy applications using Next.js, Replicache, and EdgeDB. It includes essential functionalities for real-time collaboration with offline capabilities and a ready-to-use API setup.
This project implements Replicache's "reset strategy" for data synchronization and conflict resolution.
For more details on the reset strategy and other synchronization approaches with Replicache, visit the synchronization strategies overview on their documentation site.
This project follows a structured approach typical of Next.js applications with additional directories specific to Replicache and EdgeDB:
.βββ app # Next.js pages and componentsβ βββ api # API routesβ β βββ pull # Pull endpoint for Replicacheβ β β βββ route.tsβ β βββ push # Push endpoint for Replicacheβ β βββ route.tsβ βββ components # React componentsβ β βββ TodoList.tsx # Todo list componentβ βββ favicon.ico # Faviconβ βββ globals.css # Global CSS stylesβ βββ layout.tsx # Layout componentβ βββ page.tsx # Entry point for the appβββ dbschema # EdgeDB schema filesβ βββ default.esdl # EdgeDB schema definitionβ βββ migrations # Schema migrationsβββ lib # Library functions and componentsβ βββ edgedb.ts # EdgeDB client configurationβ βββ mutators.ts # Replicache mutator functionsβ βββ types.ts # TypeScript types for the projectβββ public # Static assets like images and fontsβββ edgedb.toml # EdgeDB configuration fileβββ eslint.config.js # ESLint configurationβββ next-env.d.ts # Next.js typesβββ next.config.js # Next.js configurationβββ package.json # NPM dependencies and scriptsβββ pnpm-lock.yaml # pnpm lockfileβββ postcss.config.js # PostCSS configurationβββ README.md # Project READMEβββ tailwind.config.ts # Tailwind CSS configurationβββ tsconfig.json # TypeScript configuration
git clone https://github.com/edgedb/nextjs-replicache-edgedb-starter.gitcd nextjs-replicache-edgedb-starter
pnpm install # or npm install or yarn install
Run the EdgeDB project initialization:
npx edgedb project init
Create a .env.local
file in the root directory and add the following environment variables:
NEXT_PUBLIC_REPLICACHE_LICENSE_KEY = "your-replicache-license-key"
You can get your Replicache license key by running:
npx replicache@latest get-license
Replace the Replicache key in the page.tsx
file with your license key.
const replicache = new Replicache({name: userID,- licenseKey: TEST_LICENSE_KEY,+ licenseKey: process.env.NEXT_PUBLIC_REPLICACHE_LICENSE_KEY,mutators: { createTodo, updateTodo, deleteTodo },puller: pull,});
pnpm dev # or npm run dev or yarn dev
Open http://localhost:3000 with your browser to see the app.
Adjust the schema in dbschema/default.esdl
to meet your application's needs. For example, add new types or extend existing ones with additional properties.
Modify data fetching logic in the lib directory to enhance or alter how data interacts between the client and the database.
Update the global CSS styles in app/globals.css
or add new styles using Tailwind CSS utility classes.
Deploy your application to production using Vercel: