This is a NextJS starter in Firebase Studio.
To get started, take a look at src/app/page.tsx.
While this project is configured for Firebase App Hosting, it's a standard Next.js application and can be deployed on any server that supports Node.js, including those managed by panels like FastPanel.
Here is a general guide to get you started. You may need to consult your FastPanel documentation for specific steps, especially for setting up the reverse proxy.
The easiest way to manage your code is with Git. Access your server via SSH and clone your repository:
git clone <your-repository-url>
cd <your-project-directory>Make sure you have Node.js installed on your server (FastPanel may have a tool for this). Then, install the project dependencies and build the app for production:
# Install required packages
npm install
# Build the application
npm run buildFor the AI features (generated descriptions, full bet generation, oracle, AI voice) to work, you need to provide your Google AI API key.
Important: Google's AI services, including Text-to-Speech, are subject to usage policies and pricing. While a free tier is often available, usage beyond its limits will incur costs associated with your Google Cloud account. Please ensure you have a valid project with billing enabled and an API key.
Create a file named .env.local in the root of your project directory on the server:
# Create the environment file
touch .env.localEdit this file and add your API key:
# .env.local
GOOGLE_API_KEY=your_google_api_key_here
NEXT_PUBLIC_ADMIN_PASSWORD=your_secret_password_here
Important: Never commit this file to Git.
To keep your application running permanently, even after a server reboot, it's best to use a process manager like pm2.
# Install pm2 globally
npm install pm2 -g
# Start the Next.js app with pm2
pm2 start npm --name "inspairbet" -- start
# Tell pm2 to save the process list
pm2 save
# Generate a startup script to run on boot
pm2 startupThe pm2 startup command will output another command that you need to copy and run. This command will register pm2 as a service that starts automatically when the server boots, ensuring your "inspairbet" app also restarts. You can check its status with pm2 list.
Your Next.js app is now running, likely on port 3000. To make it accessible to the world via your domain (e.g., https://your-domain.com), you need to set up a reverse proxy.
In your FastPanel dashboard, look for a "Reverse Proxy", "Proxy", or "Node.js App" section. You'll need to create a rule that forwards incoming traffic from your domain to the local address where your app is running (http://localhost:3000).
This setup tells the main web server (like Nginx or Apache) to pass requests for your site to your running Node.js application.
This project includes a Dockerfile to make it easy to deploy as a Docker container, which is a great option for Unraid.
A. Building the Docker Image:
First, ensure you have Docker installed on a machine (it can be your local computer or directly on Unraid via SSH). Navigate to the project's root directory and run:
# Don't forget the dot (.) at the end! It tells Docker where to find your files.
docker build -t inspairbet .This command builds a Docker image from the Dockerfile and tags it with the name inspairbet.
B. Running the Container:
To run the container and ensure it restarts automatically after a server reboot, you need to provide your .env.local file and a restart policy.
docker run -d -p 3000:3000 --restart unless-stopped --env-file .env.local --name inspairbet-app inspairbet-d: Runs the container in detached mode (in the background).-p 3000:3000: Maps port 3000 from inside the container to port 3000 on your server.--restart unless-stopped: This is the crucial part. It tells Docker to automatically restart the container unless it was explicitly stopped. This ensures your app comes back online after a server reboot.--env-file .env.local: Tells Docker to load environment variables from your.env.localfile.--name inspairbet-app: Gives your running container a friendly name.
C. On Unraid:
- Go to the "Docker" tab in your Unraid dashboard.
- Click "Add Container".
- You'll be presented with a template to fill out. At the top right, click "Advanced View" to see all options.
- Name:
inspairbet-app(or whatever you like) - Repository:
inspairbet(the name you used when building the image) - Restart Policy: Select
Unless-stopped. This is the key to making sure your app starts after a reboot. - Network Type: Bridge
- Port Mapping: Click "Add another Path, Port, Variable...", set "Container Port" to
3000and "Host Port" to3000(or another available port on your Unraid server). - Environment Variables: Add a variable for
GOOGLE_API_KEYand paste your key. Add another forNEXT_PUBLIC_ADMIN_PASSWORDand paste your admin password. Alternatively, if you can map a file, you can map your.env.localfile.
- Name:
- Click "Apply" to start your container.
Your app should now be accessible at http://<your-unraid-ip>:<host-port>. You can then use a reverse proxy like Nginx Proxy Manager (available as a popular app in Community Applications) to point a domain name to it and handle SSL certificates automatically with a simple user interface.
That's the general process! Each hosting panel has its own interface, but the core principles of building the app, running it with a process manager, and proxying traffic to it remain the same.