GraphQL API server for DeezerRoom application.
- Next.js 16 - React framework with App Router
- TypeScript - Type safety
- GraphQL Yoga - GraphQL server
- ESLint + Prettier - Code quality and formatting
npm installnpm run devStarts the development server at http://localhost:3000 (accessible from all network interfaces 0.0.0.0)
Use specific IP address:
Bash (Linux/Mac):
npm run dev -- -H 192.168.1.100PowerShell (Windows):
npx next dev -H 192.168.1.100Use custom port:
Bash (Linux/Mac):
PORT=8080 npm run devPowerShell (Windows):
$env:PORT=8080; npm run devCombine port and IP:
Bash (Linux/Mac):
PORT=8080 npm run dev -- -H 192.168.1.100PowerShell (Windows):
$env:PORT=8080; npx next dev -H 192.168.1.100When your phone and development machine are on different networks (e.g., at School 42), you need to create a tunnel for the GraphQL server:
Prerequisites:
- Install
ngrokglobally:npm install -g ngrok
- Create an account at ngrok.com and get your
authtoken - Configure ngrok with your authtoken (one-time setup):
ngrok config add-authtoken <your-authtoken>
Start server and tunnel (two terminals):
Terminal 1 - Start the server:
npm run devTerminal 2 - Create tunnel:
ngrok http 3000Important: Copy the ngrok URL (e.g., https://xxxx-xx-xx-xx-xx.ngrok-free.app) and set it as EXPO_PUBLIC_SERVER_URL in your deezeroom client .env file:
EXPO_PUBLIC_SERVER_URL=https://xxxx-xx-xx-xx-xx.ngrok-free.appNote: The ngrok URL changes each time you restart the tunnel. You'll need to update EXPO_PUBLIC_SERVER_URL accordingly.
For custom port (e.g., 8080):
If you need to use a different port, start the server with that port and create a tunnel to it:
Terminal 1:
PORT=8080 npm run devTerminal 2:
ngrok http 8080PowerShell (Windows):
# Terminal 1
$env:PORT=8080; npm run dev
# Terminal 2
ngrok http 8080Note: In production mode (npm start), you can set both PORT and HOSTNAME via environment variables:
Bash (Linux/Mac):
PORT=3000 HOSTNAME=0.0.0.0 npm startPowerShell (Windows):
$env:PORT=3000; $env:HOSTNAME="0.0.0.0"; npm startnpm run buildnpm startnpm run lint # Check for linting errors
npm run lint:fix # Auto-fix linting errorsnpm run format # Format all files
npm run format:check # Check formatting without changesdeezeroom-server/
├── src/
│ └── app/
│ └── api/
│ └── graphql/ # GraphQL API endpoint
├── graphql/ # GraphQL schema and resolvers
├── services/ # Business logic (Deezer API integration)
└── types/ # TypeScript type definitions
This project does not require a .env file. Configuration can be done in several ways:
- Development: Use
PORTand-Hflags (see Development section) - Production (local): Use
PORTandHOSTNAMEenvironment variables via command line
Note: In PowerShell, $env:PORT=8080 sets the variable only for the current terminal session and won't affect other projects or terminals.
Create a .env.local file in the project root to isolate settings for this project:
PORT=8080
HOSTNAME=0.0.0.0Next.js automatically reads .env.local files. This keeps your project settings separate from other projects.
Important: Add .env.local to .gitignore (already included) to avoid committing local settings.
No configuration needed - Vercel manages everything automatically.
This project is configured for deployment on Vercel.
Important: When deploying to Vercel, you do NOT need to set PORT or HOSTNAME environment variables. Vercel automatically manages:
- Port assignment (Vercel uses its own internal port)
- Hostname (your app will be accessible via Vercel's provided URL, e.g.,
https://your-project.vercel.app)
No environment variables are required for this server application. The GraphQL API endpoint will be available at:
https://your-project.vercel.app/api/graphql
To deploy:
- Push your code to GitHub/GitLab/Bitbucket
- Import the project in Vercel dashboard
- Vercel will automatically detect Next.js and deploy
The deployed URL will be provided by Vercel and can be used as EXPO_PUBLIC_APP_URL in your deezeroom client application.
Scenario: Start server on localhost:3000 with ngrok tunnel for remote access.
Step 1: Setup ngrok (one-time):
npm install -g ngrok
ngrok config add-authtoken <your-authtoken>Step 2: Start server (Terminal 1):
Bash (Linux/Mac):
npm run devStep 3: Create tunnel (Terminal 2):
ngrok http 3000Step 4: Copy ngrok URL (e.g., https://xxxx-xx-xx-xx-xx.ngrok-free.app) and set in deezeroom/.env:
EXPO_PUBLIC_SERVER_URL=https://xxxx-xx-xx-xx-xx.ngrok-free.appNote: ngrok tunnels to localhost, so use port 3000 (not IP) in the ngrok command.