-
Node.js (v18 or higher recommended)
- Check if installed:
node --version - Install from: https://nodejs.org/
- Check if installed:
-
npm (comes with Node.js)
- Check if installed:
npm --version
- Check if installed:
-
MongoDB (optional, for bookmark features)
- Local MongoDB: Install from https://www.mongodb.com/try/download/community
- OR use MongoDB Atlas (cloud): https://www.mongodb.com/cloud/atlas
- OR use Docker:
docker-compose up -d(runs MongoDB on port 27017)
-
Shortcut API Token
cd /Users/stonse/projects/GitHub/snipnpm installCreate a .env file in the project root:
# Required: Shortcut API Token
SHORTCUT_TOKEN=your_shortcut_api_token_here
# Optional: MongoDB Configuration
# For local MongoDB (default):
MONGO_URI=mongodb://localhost:27017
MONGO_DB_NAME=snip
# OR for MongoDB Atlas (remote):
# MONGO_USER=your_mongo_username
# MONGO_PASS=your_mongo_password
# MONGO_CLUSTER=your_cluster.mongodb.net
# MONGO_DB_NAME=snip
# Optional: Server Port (default: 3001)
# PORT=3001Example .env file:
SHORTCUT_TOKEN=abc123xyz789
MONGO_URI=mongodb://localhost:27017
MONGO_DB_NAME=snipOption A: Using Docker Compose
docker-compose up -dOption B: Using MongoDB installed locally
# macOS (using Homebrew)
brew services start mongodb-community
# Linux
sudo systemctl start mongod
# Windows
# Start MongoDB service from Services panelNote: If you're using MongoDB Atlas, skip this step.
Runs both frontend and backend with hot-reload:
npm run devThis will start:
- Frontend: http://localhost:3000 (Vite dev server)
- Backend: http://localhost:3001 (Express API server)
Open your browser to: http://localhost:3000
If you prefer to run frontend and backend separately:
Terminal 1 - Backend:
npm run dev:serverTerminal 2 - Frontend:
npm run dev:client- Build the frontend:
npm run build- Start the production server:
npm startOr use the combined command:
npm run build-and-startThe app will be available at: http://localhost:3001
npm run dev- Run both frontend and backend in development modenpm run dev:client- Run only the frontend (port 3000)npm run dev:server- Run only the backend (port 3001)npm run build- Build frontend for productionnpm run preview- Preview production buildnpm start- Start production servernpm run build-and-start- Build and start in one command
If port 3000 or 3001 is already in use:
For frontend (port 3000):
- Edit
vite.config.tsand change theserver.portvalue
For backend (port 3001):
- Set
PORT=3002(or another port) in your.envfile - Update
vite.config.tsproxy target to match
- Local MongoDB: Ensure MongoDB is running (
docker-compose up -dor start MongoDB service) - MongoDB Atlas: Verify your connection string and credentials
- The app will continue to run without MongoDB, but bookmark features won't work
The server will exit with an error if SHORTCUT_TOKEN is not set. Make sure your .env file exists and contains the token.
If you see module errors, try:
rm -rf node_modules package-lock.json
npm install- Press
Ctrl+Cin the terminal where the app is running - If using Docker for MongoDB:
docker-compose down
Once running, you can verify the backend is working:
curl http://localhost:3001/api/healthExpected response:
{
"status": "ok",
"timestamp": "2024-01-01T00:00:00.000Z",
"env": "development"
}