Couchbase Capella Starter
Type: Code
Framework: Next.js
CSS: Tailwind
Database: Couchbase
- Overview: A Next.js project integrated with Couchbase Capella for managing user profiles, using Vercel for deployment.
Prerequisites for Vercel Deployment:
- A Vercel account.
- Access to a Couchbase Capella database with the Query Service enabled or signing up for a free Capella database during the integration flow.
- Creation of a
user_profile
bucket and aprofile
collection within the_default
scope in Capella.
Deployment Steps on Vercel:
- Click on the Deploy button provided in the documentation.
- Follow the steps prompted, including the integration step that connects to Couchbase Capella.
- Upon deployment, sample profiles will be automatically added, and you can interact with the application to create, update, and delete user profiles.
Common Pitfalls and FAQs:
- Issues like infinite loading, bucket not found, or parsing errors typically indicate incorrect bucket setup or environment variable configuration.
- A 504 Gateway Timeout error usually suggests connectivity issues between the application and the database.
Live Demo:
- Access the live demo at https://couchbase-nextjs-quickstart.vercel.app/.
Tech Stack:
- Next.js for the frontend.
- Tailwind CSS for styling.
- Couchbase Capella as the backend database.
- Vercel for deployment.
Running Locally:
- Requires a Couchbase Capella database or a local Couchbase 7+ database.
- Node.js & NPM installed.
- Clone the project and install dependencies with
npm install
. - Manually create a
user_profile
bucket andprofile
collection in Capella for local development. - Update
.env.local
with the necessary environment variables, including Couchbase credentials and connection string. - Initialize the database with
npm run init-db:local
and optionally load sample data withnpm run load-sample-data
. - Run the application with
npm run dev
and access it atlocalhost:3000
.
Sample Data:
- The project includes a
MOCK_DATA.json
file for testing, which can be manually imported into Capella or loaded locally using the provided npm script.
Additional Notes:
- The
.env.default
file is for testing and Gitpod instances to facilitate setup. - For Capella databases, manual setup of the bucket, collection, and indices is necessary, followed by
npm run build-indexes
to create required indices.
Running Tests:
- Integration tests are included and can be run after initializing the database with
npm run init-db:default
followed bynpm test
.