Skip to content

Daily service responsible mostly for providing content related information such as posts, publications, tags, etc

License

Notifications You must be signed in to change notification settings

sshanzel/daily-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daily API V2

Service for delivering and managing Daily content

Build Status License StackShare

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.

Technology

  • NPM for managing dependencies.
  • Node v12.16.2 (a .nvmrc is presented for nvm users).
  • Fastify as the web framework
  • Apollo for GraphQL
  • Typeorm as a database layer

Project structure

  • __tests__ - There you can find all the tests and fixtures. Tests are written using jest.
  • bin - Folder with utilities and executables.
  • helm - The home of the service helm chart for easily deploying it to kubernetes.
  • seeds - JSON files with seed data for local development.
  • migrations - Knex migrations folder.
  • src - This is obviously the place where you can find the source files.
    • common - Utility functions that are used across the project.
    • compatibility - Fastify routes to keep backwards compatibility with API v1.
    • cron - Tasks that will be deployed as cron jobs.
    • directive - GraphQL schema directives.
    • entity - Typeorm entities that are used to communicate with the database and sync its schema.
    • migration - Typeorm migrations folder to update the database schema.
    • schema - Apollo GraphQL resolvers, including also types.
    • workers - Pub/Sub message handlers that are deployed as part of the background processor.

Local environment

Daily API requires a running instance of PostgreSQL, you can easily set it up using the provided docker-compose file. Check out this guide of how to install Docker Compose. Once installed, you can run docker-compose up -d and viola!

Make sure to apply the latest migrations by running: npm run db:migrate:latest

.env is used to set the required environment variables. It is loaded automatically by the project.

If you want some seed data you can run: npm run db:seed:import

Finally run npm run dev to run the service and listen to port 5000.

Caveat

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.

Currently, there is no staging environment for Algolia so there is no search functionality for local development.

Want to Help?

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/dailydotdev/.github/blob/master/CONTRIBUTING.md

About

Daily service responsible mostly for providing content related information such as posts, publications, tags, etc

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.2%
  • Smarty 1.1%
  • Other 0.7%