https://github.com/audiusproject/api
Open source API backend for audius.co
https://github.com/audiusproject/api
audio ethereum protocol solana streaming web3
Last synced: 11 days ago
JSON representation
Open source API backend for audius.co
- Host: GitHub
- URL: https://github.com/audiusproject/api
- Owner: AudiusProject
- License: apache-2.0
- Created: 2025-03-26T18:02:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-29T01:44:14.000Z (15 days ago)
- Last Synced: 2026-05-29T03:24:31.913Z (15 days ago)
- Topics: audio, ethereum, protocol, solana, streaming, web3
- Language: Go
- Homepage: https://api.audius.co
- Size: 13.6 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Audius API Server
The API backend for the Audius mobile apps and [audius.co](https://audius.co)
[](https://github.com/AudiusProject/api/blob/main/LICENSE) [](https://github.com/AudiusProject/api/releases/latest)
## Running
### Server
1. Create `.env` file:
```
readDbUrl='postgresql://postgres:somepassword@someip:5432/audius_discovery'
```
Regular database dumps are posted to S3, and can be pulled with
```
curl https://audius-pgdump.s3-us-west-2.amazonaws.com/discProvProduction.dump -O
pg_restore -d \
--username postgres \
--no-privileges \
--clean --if-exists --verbose -j 8 \
discProvProduction.dump
```
(more env vars and their defaults can be found in `config.go`)
2. Run `make setup` (the first time)
```
make setup
```
3. Run `make`
```
make
```
http://localhost:1323/v1/users/handle/audius
This will watch sql files + re-run `sqlc generate` + restart server when go files change.
### Tests
#### To run tests against the existing schemas
```
docker compose up -d
make test
```
#### To update schema after migration changes and run tests
```
make test-schema
make test
```
### Build
```
go build -o api main.go
```
## API diff
Tool for comparing the new API server endpoints with the legacy Discovery Node APIs
http://localhost:1323/apidiff.html
## Adminer
Tool for interacting with the postgres server
http://localhost:21301/?pgsql=db&username=postgres
## ElasticSearch
ElasticSearch is configured by the env var `elasticsearchUrl`.
Tool for interacting with search
http://localhost:1323/searchtest.html
Re-index collections from scratch:
```
go build -o api main.go
time ./api reindex
```
You can also specify specific indexes. If you change the mapping you can add `drop`:
```
go build -o api main.go
time ./api reindex drop playlists
```
### Re-index in stage or prod
If you make mapping changes, or want to re-index everything, you can do:
```
make esindexer-reindex-stage
#or
esindexer-reindex-prod
```
A deploy might disrupt this command, in which case, run it again.
See `Makefile` for more details.