This is the backend service repository of MatchMe app. DTT stands for Discrete Trial Training.
To get started with this project, you'll need the following prerequisites:
- MongoDB (tested with v3.6 and v7.0)
- A Replicate API key
- A writable directory to store user-uploaded and AI-generated photos
Moreover, you'll need both backend and frontend to make the app work. After you've deployed the two ends, you'll use nginx
to map the services onto the same port (80 or 443). See appendix for sample nginx
configuration snippet.
You can choose to run a binary release or build from source code.
See the Releases page. We currently provide binaries for Windows (x64) and Linux (x64). Those executables are completely standalone (no external library required). You can run it directly in your shell with:
# Linux
export REPLICATE_API_KEY=xxxx
./linux_server
# Windows PowerShell
$env:REPLICATE_API_KEY=xxxx
.\windows_server.exe
You'll need go
and git
to build the project.
After cloning this repository, cd
into it and run:
go build ./cmd/server
As long as you have a working Internet connection (or GOPROXY
properly set), go
will automatically download all the dependencies and generate the executable.
# Add this in your `server` block:
location /api { # Backend
proxy_pass http://localhost:8080;
}
location / { # Frontend
proxy_pass http://localhost:3000;
}
As of v0.1.0, MatchMe backend uses in-code constants for configuration. Before you build, make sure to change those constants into desired values:
DBAddr
andDBName
for your MongoDB configurationPhotoDir
for your writable UGC directoryOurAddr
for your IP or domain
If you have your own deployment on Replicate, you should change the CreatePredictionWithDeployment
invocation in this file to use yours as well.
More flexible settings are planned for the next release.