nabu is an open-source learning tool I built to make studying easier.
(these docs are out of date! missing Supabase-related instructions. if you're interested in utilizing this code, feel free to reach out and I'll help you get started with it.)
- Node.js >= 14
- An OpenAI API Key
- A MongoDB database
- A Redis instance
- Next.js - A React-based framework for building server-side rendered and statically exported web applications
- OpenAI LLMs - Large language models developed by OpenAI
- Tailwind CSS - A utility-first CSS framework for rapidly building custom user interfaces
- Axios - A popular library for making HTTP requests in JavaScript
- NextAuth.js - A complete authentication solution for Next.js applications
- MongoDB - A popular NoSQL database used for storing user information
- Mongoose - An Object Data Modeling (ODM) library for MongoDB and Node.js
- Redis - An in-memory data structure store, used as a database, cache, and message broker
- Crypto - A built-in Node.js module for handling cryptographic operations
- Supabase - An open source Firebase alternative
We use MongoDB for storing user information and session data. You can set up a MongoDB instance in several ways:
- Download and install MongoDB directly on your local machine.
- Use a Docker container to run MongoDB.
- Use a managed MongoDB service, like MongoDB Atlas, which offers a free tier.
Once you have a running MongoDB instance, you'll need to obtain the connection string. If you're using MongoDB Atlas, you can find the connection string in your cluster's connection settings.
We use Redis for rate limiting in our API routes (currently disabled). You can set up a Redis instance in several ways, including:
- Download and install Redis directly on your local machine (not recommended for Windows users).
- Use a Docker container to run Redis.
- Use a managed Redis service, like RedisLabs, which offers a free tier.
Once you have a running Redis instance, you'll need to obtain the connection string. If you're using RedisLabs, you can find the connection string in your database's configuration page.
-
Clone or fork this repository
-
Navigate to the project directory:
cd your_path/nabu-learning
-
Install the dependencies:
npm install
-
Create a
.env.local
file in the project root and add the necessary environment variables:touch .env.local
Add the following to the
.env.local
file:NEXTAUTH_URL=http://localhost:3000 MONGODB_URI=yourURI NEXTAUTH_SECRET=yourSecret REDIS_URL=yourRedisConnectionString
Replace http://localhost:3000
with whatever port or URL your application is running on, yourURI
with your MongoDB connection string, yourSecret
with a secure random string, and yourRedisConnectionString
with your Redis connection string.
...
-
To run the development server:
npm run dev
-
To build the application for production:
npm run build
-
To start the production server:
npm run start
To deploy your nabu Clone to Vercel, follow these steps:
-
Sign up for a Vercel account if you haven't already.
-
Install the Vercel CLI:
npm install -g vercel
-
Log in to your Vercel account from the command line:
vercel login
-
Navigate to your project directory:
cd nabu
-
Run the following command to deploy your application:
vercel --prod
-
During the deployment process, the Vercel CLI will ask you for the environment variables. Provide the same values you used for your
.env.local
file:NEXTAUTH_URL: https://your-vercel-url.vercel.app MONGODB_URI: yourURI NEXTAUTH_SECRET: yourSecret REDIS_URL=yourRedisConnectionString
Replace http://localhost:3000
with whatever port your application is running on, yourURI
with your MongoDB connection string, yourSecret
with a secure random string, and yourRedisConnectionString
with your Redis connection string.
- Once the deployment is complete, Vercel will provide you with a live URL to access your nabu Clone.
Remember that every time you make changes to your nabu Clone and want to deploy the updated version, you can simply run vercel --prod
from the project directory.
This project is licensed under the MIT License.