Skip to content

Commit a4b87ec

Browse files
committed
Update deployment
1 parent a001fc7 commit a4b87ec

1 file changed

Lines changed: 27 additions & 50 deletions

File tree

DEPLOYMENT.md

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,39 @@
1-
# Deployment Guide
1+
# DIMO Build Developer Kit
22

3-
## Production Build and Deployment
3+
## Overview
44

5-
### Prerequisites
6-
Before deploying, ensure you have:
7-
1. Built the application for production
8-
2. Set up static file serving correctly
9-
3. Configured environment variables
5+
This is a Replit template for running an app that integrates [Login with DIMO](https://www.npmjs.com/package/@dimo-network/login-with-dimo) and [DIMO Data SDK](https://www.npmjs.com/package/@dimo-network/data-sdk).
106

11-
### Building for Production
7+
## Quick Start
128

13-
Run the production build script:
14-
```bash
15-
./build-production.sh
16-
```
17-
18-
This script will:
19-
1. Run `npm run build` to build both the client and server
20-
2. Create the `server/public` directory
21-
3. Copy static files from `dist/public` to `server/public`
9+
1. Remix this Replite Template
10+
2. Update secrets with your own DIMO Developer License credentials, if you don't have these credentials, sign up on the [DIMO Developer Console](https://console.dimo.org):
11+
- Client ID: `DIMO_CLIENT_ID` & `VITE_DIMO_CLIENT_ID`
12+
- Redirect URI: `DIMO_REDIRECT_URI` & `VITE_DIMO_REDIRECT_URI`
13+
- API Key: `DIMO_API_KEY`
2214

23-
### Starting the Production Server
15+
## Deployment Configuration
2416

25-
#### Option 1: Using the startup script (Recommended)
26-
```bash
27-
./start-production.sh
28-
```
17+
### Production Build Process
18+
- **Build Script**: Custom `build-production.sh` script handles complete production build
19+
- **Static File Serving**: Fixed file path mismatch between build output (`dist/public`) and server expectations (`server/public`)
20+
- **Host Binding**: Server configured to bind to `0.0.0.0:5000` for proper interface access
21+
- **Environment Detection**: Automatic switching between development (Vite HMR) and production (static file serving) modes
2922

30-
#### Option 2: Manual startup
31-
```bash
32-
NODE_ENV=production node dist/index.js
33-
```
34-
35-
### Key Deployment Fixes Applied
36-
37-
1. **Static File Serving**: Fixed the mismatch between build output (`dist/public`) and expected location (`server/public`)
38-
2. **Host Binding**: Server is configured to bind to `0.0.0.0:5000` for proper interface access
39-
3. **Production Mode**: The server correctly serves static files in production using the `serveStatic` function
40-
4. **ES Module Compatibility**: Created DIMO SDK wrapper to handle directory import issues
41-
5. **Custom Build Process**: Updated esbuild configuration with proper externals and bundling
42-
6. **Graceful Fallback**: DIMO SDK wrapper provides proper error handling and fallback behavior for production deployment
43-
44-
### Environment Variables
45-
- `PORT`: Server port (defaults to 5000)
46-
- `NODE_ENV`: Set to "production" for production deployment
47-
48-
### File Structure
23+
### Build Output Structure
4924
```
5025
├── dist/
51-
│ ├── index.js # Built server
52-
│ └── public/ # Built client files (Vite output)
26+
│ ├── index.js # Bundled server (ESBuild)
27+
│ └── public/ # Client build output (Vite)
5328
├── server/
54-
│ └── public/ # Static files for production serving
55-
├── build-production.sh # Production build script
56-
└── package.json
29+
│ └── public/ # Production static files location
5730
```
5831

59-
### Troubleshooting
60-
- If static files aren't served, ensure `server/public` exists and contains the built client files
61-
- Verify the server is binding to `0.0.0.0` and not just `localhost`
62-
- Check that `NODE_ENV=production` is set when running the production server
32+
### Deployment Requirements
33+
- Node.js runtime environment
34+
- Environment variable `NODE_ENV=production`
35+
- Port configuration via `PORT` environment variable (defaults to 5000)
36+
- Static files must be properly copied to `server/public` before starting production server
37+
38+
## Source
39+
This template is based on the using DIMO's Developer SDKs. For more information, visit https://docs.dimo.org/developer-platform/developer-guide/dimo-developer-sdks

0 commit comments

Comments
 (0)