Giter Club home page Giter Club logo

periodum-api's Introduction

Periodum API

main workflow

Periodum project's backend.

Tech Stack

  • NodeJS: v16.13.2 (includes npm v8.1.2) with TypeScript
  • PostgreSQL: v12.1
  • Latest Docker Engine with Docker-Compose

Development

Run localy

After you have required tech stack above, feel free to run it like this.

npm install && \
npx prisma generate && \
npm run dev

Run inside Docker

# Run the db in background
docker-compose --env-file ./dev.env up -d db

# Run the app in foreground
docker-compose --env-file ./dev.env up app --build

# Run the app in background
docker-compose --env-file ./dev.env up -d app --build

Some tips

  • --build arg is required when you need to install new package unless you install inside the container.

  • You can connect to the running container via VSCode without installing NodeJS or any other dependencies on your machine. Just attach to the Periodum API container after running the container.

Running migrations

Please always follow the latest Prisma documentation for migrations.

# It will reset the db,
# apply all migrations
# and run the seed
# Currently it will import only Elements and Isotopes
npx migrate reset

# For help you man checkout the manual
npx prisma migrate --help

Prisma Migration Commands

# Create a migration from changes in Prisma schema,
# apply it to the database,
# trigger generators (e.g. Prisma Client)
prisma migrate dev

# Reset your database and apply all migrations
prisma migrate reset

# Apply pending migrations to the database in production/staging
prisma migrate deploy

# Check the status of migrations in the production/staging database
prisma migrate status

Contribution Guidelines

Please follow the same guidelines with the main project.

TL;DR

  • Fork the repository
  • Create a feature or bugfix branch from the develop branch (ex: feature/awesome-feature) on your fork.
  • Work on your new branch
  • To avoid working on the same issue; after very first commit, please create a draft pull request to our develop so other contributors will know that you're working on the issue. Other contributors might give you early feedback on your implementation for saving time
  • When it's ready, change the PR to "Ready to Review"

Contact

Feel free to join our Discord chat. After join Evrim Ağaçı's server, find us on Periodum channels.

periodum-api's People

Contributors

cagrimertbakirci avatar mt410 avatar nesimtunc avatar t410 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

periodum-api's Issues

Elements endpoint

We should have an endpoint that returns all the elements with these properties.

{
  atomic_mass
  boil_use
  melt_use
  block
  type
  symbol
  searchClass
  name_tr
  number
  xpos
  ypos
}

🤔 Switching from express to fastify?

Since Discussion doesn't seem useful, let's discuss here.

Recently, fastify is appealing to me. Benchmarks are insane!

Thinking to switch from express to fastify. What do you think? Anyone experienced?

Currently, let's not put this as a task in the Projects.

✨ Create Project's Code Base

Create the project structure based on README Tech Stack

  • Create Code Base (NodeJS, NPM or YARN, TypeScript)
  • Dockerize The Project
  • Complete the PR's tasks

PubChem remaining tasks

Per our conversation with @nesimtunc, here are the tasks that need to be done

  • Create a table in the DB for keeping track of the imported/failed compounds.
  • Use that table to rerun the script if the script crashes unexpectedly.
  • Limit retry amounts for failed compounds.
  • Create an endpoint to show the statistics, ie: the time to import a number of compounds, success/fail ratio, how many compounds are left to import
  • Create a POST endpoint to trigger the import script with an authentication(token may be stored in .env) header with a JSON body that includes the startID and endID and an option to continue from the last compound
  • Create a POST endpoint to trigger pause and stop the import script

Originally posted by @T410 in #16 (comment)

Update Documents

Current Docker environment is only development purpose. We need a production environment as well. It's no big task, we can just copy current settings and separate them individually.

Also, we might create Docker Images on Docker Hub and push automatically.

Maybe create a Wiki page.

TODOs:

  • Copy Docs Template (issue, PR etc. ) from Main Project
  • Separate DEV / PROD env. on Docker

Integrate GitHub Actions for CI

For now, only GitHub actions would be enough for us to validate coding style, later after unit tests we can add that step too.

It should run lint

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.