DEMO
𝐅𝐎𝐑𝐊 𝐑𝐄𝐂𝐎𝐌𝐌𝐄𝐍𝐃𝐄𝐃
You can deploy this Next.js application to a variety of platforms. Here are instructions for some common options.
Vercel is a platform from the creators of Next.js and is one of the easiest ways to deploy your application.
- Push to a Git Repository: Push your code to a GitHub, GitLab, or Bitbucket repository.
- Import Project on Vercel: Go to your Vercel dashboard and import the project from your Git repository.
- Configure Project: Vercel will automatically detect that you are using Next.js and configure the build settings for you.
- Add Environment Variables: If your application requires environment variables (e.g., API keys), add them in the "Environment Variables" section of your project settings on Vercel. You will need to set
GEMINI_API_KEYfor the AI features to work. - Deploy: Click the "Deploy" button. Your application will be built and deployed. Vercel will provide you with a URL to access your live site.
You can also deploy this application to any Virtual Private Server (VPS) or a server with Node.js support.
- Setup Your Server: Ensure your server has Node.js (version 18.x or higher) and npm installed.
- Clone Your Repository: Clone your code onto the server.
git clone https://github.com/mrxbroken011/ai-code-assistant.git cd ai-code-assistant - Install Dependencies:
npm install
- Set Environment Variables: Create a
.env.localfile in the root of your project and add your environment variables.GEMINI_API_KEY=your_gemini_api_key - Build Your Application:
npm run build
- Start the Server:
This will start the production server on port 3000 by default.
npm run start
For a production environment, it is highly recommended to use a process manager like pm2 to keep your application running continuously.
- Install pm2 globally:
npm install pm2 -g
- Start your app with pm2:
pm2 start npm --name "my-next-app" -- run start - Save the process list:
pm2 save
- Setup startup script (to automatically restart on server reboot):
This will provide a command you need to run to complete the setup.
pm2 startup
