Skip to content

berkmancenter/nymspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nymspace

Nymspace is a pseudonym-based chat app built by the Berkman Center. Nymspace is organized into two repos:

  • nymspace_server - a node.js/express/socket.io/mongodb/mongoose chat server
  • nymspace_client - a vue.js application that consumes the server APIs and presents a chat application to participants.

This third repo contains documentation for self-hosting and deploying nymspace frontend and backend to a production environment.

Deploy with Docker Compose

We provide a single file deployment with docker compose in docker-compose.yml.

  • Create an .env file based on .env.example
  • edit the env variables and replace things like example.com with your domain
  • Deploy the compose file with your favorite docker management tool
  • Configure a proxy server

Nginx

We provide a sample nginx file in nymspace.conf.

Nginx Proxy Manager

If you're using a tool like nginx proxy manager, you can:

  • Add a main entry pointing your domain to the ip address of your container host
  • Point to port 8080 or whichever port you set in the docker-compose
  • Enable websocket support
  • Add these locations to your proxy host:
    • Location: /v1/ → Forward to nymspace-backend:3000
    • Location: /socket.io/ → Forward to nymspace-backend:5555

Deploy a custom instance

1. Server (Ubuntu 24)

git clone [email protected]:berkmancenter/nymspace_server.git
cp nymspace_server/.env.example cp nymspace_server/.env
rsync -avx ./nymspace_server/ [email protected]:nymspace_server
  • ssh into your server, cd into the repo, and yarn start, e.g.
ssh [email protected]
cd ~/nymspace_server && yarn start

2. Client

VITE_API_VERSION=v1
VITE_API_SERVER_URL=https://example.com
VITE_WEBSOCKET_SERVER_URL=https://example.com
  • Run yarn build
  • Copy the built files to your webserver, e.g.
rsync -avx ./nymspace_client/dist/ [email protected]:/var/www/nymspace_client/dist

3. Reverse proxy

  • Back on the server, install nginx
  • sudo nano /etc/nginx/sites-available/example.com.conf and include the template from nymspace.conf
  • ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
  • sudo systemctl restart nginx
  • make sure that the permissions are correctly set on /var/www/nymspace_client/dist for nginx to read them
  • Install and run lets encrypt to provide SSL for your domain (this will edit your nginx conf and configure ssl termination and redirects as needed)

Troubleshooting

  • Make sure you built the front end with the correct urls for the backend APIs
  • Make sure the backend started successfully
  • Check that your proxy is properly configured for WebSocket support

Environment Variables Reference

Required Variables

  • VITE_API_VERSION: API version (default: v1)
  • VITE_API_SERVER_URL: Full URL to your server
  • VITE_WEBSOCKET_SERVER_URL: WebSocket server URL (mostt likely the same as above)
  • JWT_SECRET: Secret key for JWT tokens (make a random string)
  • AUTH_TOKEN_SECRET: Secret for authentication token (make a random string)

Optional Features

  • MAX_MESSAGE_LENGTH: How long a message can be (default: 2000)
  • NYMSPACE_ENABLE_AGENTS: Enable AI agents (default: false)
  • NYMSPACE_ENABLE_POLLS: Enable polls feature (default: false)
  • NYMSPACE_ENABLE_PUBLIC_CHANNEL_CREATION: Allow users to create public channels (default: false)

Email Configuration (Optional, but must have values if present)

  • SMTP_HOST: SMTP server hostname
  • SMTP_PORT: SMTP server port
  • SMTP_USERNAME: SMTP username
  • SMTP_PASSWORD: SMTP password
  • EMAIL_FROM: From email address

LLM Configuration (Optional, but must have values if present)

  • OPENAI_API_KEY: OpenAI API key for AI features
  • LANGCHAIN_API_BASE_PATH: LangChain API base path
  • PERSPECTIVE_API_KEY: Google Perspective API key for content moderation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •