Deployment
Deploying your AgentForge app allows you to share your AI-powered application with the world.
We highly recommend checking out the ShipFast Integration if you want to build a Micro SaaS app and monetize your work.
Follow these steps to commit your code, push it to a GitHub repository, and deploy it using a hosting provider like Vercel. This guide also covers setting up the correct environment variables for deployment.
Step 1: Commit and Push Your Code to GitHub
1) Commit Your Code: Ensure all your changes are committed.
1git add .
2git commit -m "Initial commit"
Â
2) Push to a Private Repository: Push your committed code to a private repository on GitHub.
1git remote add origin https://github.com/your-username/your-private-repo.git
2git push -u origin main
Â
Step 2: Deploy Using a Hosting Provider
You can deploy your Next.js app using various hosting providers that support Next.js, such as Vercel, Netlify, Render, etc. Here’s how to do it with Vercel:
Using Vercel
- Sign In to Vercel: Go to Vercel and sign in to your account.
- Create a New Project: Click on the "New Project" button and select "Import Git Repository."
- Select Your Repository: Connect your GitHub account if prompted, and select the repository where your code is hosted.
- Configure Project: Follow the prompts to configure your project settings. Vercel will automatically detect that it’s a Next.js app.
- Set Environment Variables: Before deploying, you need to set up the environment variables. These are stored in
.env.local
and should not be committed to your repository. - Go to the "Settings" tab of your project on Vercel.
- Click on "Environment Variables."
- Add your environment variables (e.g.,
OPENAI_API_KEY
,GROQ_API_KEY
, etc.).
- Deploy: Click on the "Deploy" button. Vercel will build and deploy your application. Once the deployment is complete, you will receive a live URL to access your app.
Using Other Hosting Providers
Netlify (not tested)
- Sign In to Netlify: Go to Netlify and sign in to your account.
- New Site from Git: Click on "New site from Git."
- Connect to GitHub: Connect your GitHub account and select your repository.
- Configure Build Settings: Set the build command to
npm run build
and the publish directory to.next
.
- Set Environment Variables: Go to "Site settings" > "Build & deploy" > "Environment" and add your environment variables.
- Deploy Site: Click on "Deploy site."
Render (not tested)
- Sign In to Render: Go to Render and sign in to your account.
- New Web Service: Click on "New" > "Web Service."
- Connect to GitHub: Connect your GitHub account and select your repository.
- Configure Build and Environment: Set the build command to
npm run build
and the start command tonpm start
. Add environment variables under the "Environment" tab.
- Deploy: Click on "Create Web Service."