The project started as a monolith service for everything the extension needed (thus Daily API). Safely and slowly it was tore apart to other services to make every service has only one responsibility. The so called Daily API kept to itself the content domain. The feed you know very well is delivered from here, along with other very useful endpoints.
- Yarn for managing dependencies.
- Node v10.12.0 (a
.nvmrc
is presented for nvm users). - Koa as the web framework
The project was bootstrapped with vue cli so it is very much like any other vue project but just to make sure.
helm
- The home of the service helm chart for easily deploying it to kubernetes.migrations
- Knex migrations folderseeds
- Knex database seed filessrc
- This is obviously the place where you can find the source files.src/middlewares
- Koa custom middlewares.src/models
- Modules for interacting with the database.src/routes
- Endpoints of the serversrc/workers
- Background workers which listens to pub/sub messages.
test
- There you can find all the tests and fixtures. Tests are written usingmocha
andchai
.
Daily API requires a running instance of MySQL, you can easily set it up using docker. Check out this guide of how to setup Daily services, you need only MySQL (step 2).
When running locally the service, you will also have to set some environment variables:
export DEFAULT_IMAGE_URL=https://storage.cloud.google.com/devkit-assets/placeholder.jpg
export DEFAULT_IMAGE_PLACEHOLDER="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QCYRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAABIAAAAAQAAAEgAAAABAAWQAAAHAAAABDAyMTCgAAAHAAAABDAxMDCgAQADAAAAAQABAACgAgAEAAAAAQAAAAqgAwAEAAAAAQAAAAYAAAAA/+ECz2h0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc+CjxyZGY6UkRGIHhtbG5zOnJkZj0naHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyc+CgogPHJkZjpEZXNjcmlwdGlvbiB4bWxuczpleGlmPSdodHRwOi8vbnMuYW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FIGNA/W+llu9LbahyZ08fkhxiZeFFNaOm0Ckkp0j5//EABwRAAMBAAIDAAAAAAAAAAAAAAECAwQAExESIf/aAAgBAgEBPwGsdL6JUnsMc6Admdc8nNnD+ft6ezJJplldJoKdgjRLoqWjp5//xAAdEAACAQQDAAAAAAAAAAAAAAABAgMREiEjABMi/9oACAEBAAY/AirQXybKSdrrQNHanhcExSbAThqlHUi0rz//xAAXEAEBAQEAAAAAAAAAAAAAAAABERAx/9oACAEBAAE/IRRs0xVxiFhHGC//2gAMAwEAAgADAAAAEGP/xAAWEQEBAQAAAAAAAAAAAAAAAAABEBH/2gAIAQMBAT8QNAUSVjBHQudd/8QAFhEBAQEAAAAAAAAAAAAAAAAAARAh/9oACAECAQE/EEkCGWNRJa8Ww//EABcQAQADAAAAAAAAAAAAAAAAAAEQESH/2gAIAQEAAT8QpeTsA40GpPBD/9k="
export DEFAULT_IMAGE_RATIO=1.7
export MYSQL_USER=root
export MYSQL_PASSWORD=12345
export MYSQL_DATABASE=devkit
export URL_PREFIX=http://localhost:4000
export PORT=5000
export GATEWAY_SECRET=topsecret
If you want some seed data you can run:
npx knex seed:run
Finally run yarn watch
to run the service and listen to port 5000
.
We use husky
for setting pre-commit git hooks to encrypt helm values.
For those without access to our Google Cloud project it will throw an exception so you can simply comment it out from package.json
.
So you want to contribute to Daily API and make an impact, we are glad to hear it. 😍
Before you proceed we have a few guidelines for contribution that will make everything much easier. We would appreciate if you dedicate the time and read them carefully: https://github.com/dailynowco/.github/blob/master/CONTRIBUTING.md