3.2 KiB
JUNOHUB
JUNOHUB is a Next.js application that powers an admin and supplier portal with:
- Authentication and multi-factor auth
- Gmail integration for support tickets (Juno Engine)
- Shopify integration for orders, products, and inventory
- Knowledge base and FAQ management
- Admin dashboards for stores, suppliers, and email events
The frontend and backend are implemented in a single Next.js App Router project.
Tech Stack
- Framework: Next.js (App Router, TypeScript)
- UI: React + modern Tailwind-style components
- Auth: NextAuth
- Database: PostgreSQL (Prisma ORM)
- Background / Integrations:
- Gmail APIs (via OAuth)
- Shopify APIs
- Gemini for embeddings and chat
- Deployment: Docker + GitHub Actions → AWS EC2
Local Development
- Install dependencies
npm install
- Create
.env
Copy .env.example (or the variables listed below) into a local .env file and fill in your own values:
DATABASE_URLNEXTAUTH_SECRETNEXTAUTH_URLGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETSMTP_HOSTSMTP_PORTSMTP_SECURESMTP_USERSMTP_PASSWORDGEMINI_API_KEYGEMINI_EMBEDDING_MODELGEMINI_CHAT_MODELADMIN_EMAILADMIN_PASSWORD
Never commit real secrets;
.env*files are ignored by git.
- Run the dev server
npm run dev
Visit http://localhost:3000 in your browser.
Docker
The project can be run via Docker using the provided Dockerfile and docker-compose.yml.
Typical pattern:
docker compose up -d --build
Make sure your .env is present next to the app code so the container can read it.
CI/CD on AWS EC2
This repo includes a GitHub Actions workflow at .github/workflows/deploy-ec2.yml that:
- Runs on pushes to the
mainbranch. - Installs dependencies and builds the Next.js app.
- SSHes into an EC2 instance.
- Writes an
.envfile on the EC2 instance from a single GitHub secretEC2_ENV. - Uses
docker compose/docker-composeto build and run the app. - Performs a health check and automatically rolls back to the previous commit if the deployment or health check fails.
Required GitHub Secrets
Set the following secrets in GitHub → Settings → Secrets and variables → Actions:
EC2_HOST– public IP or DNS of the EC2 instance.EC2_USER– SSH user (e.g.ubuntu).EC2_SSH_KEY– private SSH key for that user.EC2_SSH_PORT– (optional) port, defaults to22if not set.EC2_ENV– multi-line secret containing the full contents of the.envfile used in production.
This is written to.envon the server during deployment.
Deployment Flow
- Push to
main. - GitHub Actions:
- Builds the app.
- Connects to EC2.
- Writes
.envfromEC2_ENV. - Runs
docker compose up -d --build. - Hits the health check URL (by default
http://localhost:3000/api/health).
- If the health check fails, the workflow:
- Resets the repo on EC2 to the previous commit.
- Re-runs
docker compose up -d --build.
This gives you a sharp deployment with an automatic rollback path.
License
Private / All rights reserved unless explicitly stated otherwise.