Monochrome's API, implemented with Deta Base and Deta Drive.

Overview

Monochrome

Monochrome's API, implemented with Deta Base and Deta Drive.

Create a free account on Deta to test this out!

Most users will prefer the Monochrome full stack, which contains the API, the frontend and the backend.

Usage

Docker

This service is available on ghcr.io:

docker pull ghcr.io/monochromecms/monochrome-api-deta:latest

The database needs to be set up, and an admin user created:

docker run                                         \
  -e DETA_PROJECT_KEY=...                          \
  ghcr.io/monochromecms/monochrome-api-deta:latest \
  create_admin

Once done, the image can be launched with the required env. vars:

docker run -p 3000:3000                            \
  -e DETA_PROJECT_KEY=...                          \
  -e JWT_SECRET_KEY=changeMe                       \
  ghcr.io/monochromecms/monochrome-api-deta:latest

The images are stored on Deta Drive, they are available on the /media route or on the Deta Web UI.

Makefile

A Makefile is provided with this repository, to simplify the development and usage:

help                 Show this help message
up start             Run a container from the image, or start it natively
# Docker utils
build                Build image
logs                 Read the container's logs
sh                   Open a shell in the running container
# Dev utils
lock                 Refresh pipfile.lock
lint                 Lint project code
format               Format project code
# Main utils
secret               Generate a secret
create_admin         Create a new admin user
# Tests
test                 Run the tests

So the basic usage would be:

make create_admin
make start

.env

While using the Makefile, the image settings can be set with a .env file, see .env.example.

Native

Even though Docker is the recommended method, some Makefile rules are native compatible, so a virtual environment can also be used after cloning this repository:

#You need to be able to run these commands on your terminal:
tar, 7z, unrar, xz
pip install pipenv
pipenv shell
pipenv install

make native=1 install

Environment variables

# Deta project key, more info on https://deta.sh
DETA_PROJECT_KEY
# Comma-separated list of origins to allow for CORS, namely the origin of your frontend
CORS_ORIGINS = ""

# Secret used to sign the JWT
JWT_SECRET_KEY
# Algorithm used to sign the JWT
JWT_ALGORITHM = "HS256"
# Amount of minutes a JWT will be valid for
JWT_ACCESS_TOKEN_EXPIRE_MINUTES = 60

# Path where temporary data will be stored (DON'T CHANGE THIS IN DETA MICROS)
TEMP_PATH = "/tmp"

# For pagination, the maximum of elements per request, has to be positive
MAX_PAGE_LIMIT = 50
# Allows anyone to create a "user" account
ALLOW_REGISTRATION=False

Roles

Each used can have one of different roles, this is done to have a sort of hierarchy:

Admin

The role the create-admin command gives to the user, it's the highest role and grants all the permissions (user and website management, upload and editing of manga and chapters)

Uploader

This role can create new manga and upload new chapters, but can only edit/delete those that they have created themselves.

User

This user can only update its own user for now, it'll become more useful once other features are added to Monochrome (comments, notifications, reading progress...) You can already allow registrations via the respective env var, but it isn't recommended until meaningful features are added.

Tools used

  • FastAPI
  • Deta Base
  • Deta Drive
  • Pydantic

Progress

  • Creation 🟢 100% (new features can always be added)
  • Documentation 🟡 58%
  • OpenAPI 🟡 66%
  • Cleaner code 🟡 50%
  • Testing 🟠 40% (I still need to use this implementation throughly)
    • Unit 🟢 100%
    • Integration 🔴 10%

Credits:

You might also like...
This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS).

fast-scripts This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS). In python These wi

Here is my Senior Design Project that I implemented to graduate from Computer Engineering.
Here is my Senior Design Project that I implemented to graduate from Computer Engineering.

Here is my Senior Design Project that I implemented to graduate from Computer Engineering. It is a chatbot made in RASA and helps the user to plan their vacation in the Turkish language. In order to plan the user's vacation, it provides reservations by asking various questions for hotel, flight, or event.

This is the improvised version of Dobot Magician which can be implemented for Dobot M1

pydobotM1 This is the edited driver for Dobot M1 version of the original pydobot library intended for use with the Dobot Magician. Here's what you nee

Neogex is a human readable parser standard, being implemented in Python

Neogex (New Expressions) Parsing Standard Much like Regex, Neogex allows for string parsing and validation based on a set of requirements. Unlike Rege

Black-Scholes library implemented as a Cairo smart contract

Cairo Black-Scholes Library Black-Scholes library implemented as a Cairo smart contract. All inputs, outputs, and internal calculations use 27-digit f

Process RunGap output file of a workout and load data into Apple Numbers Spreadsheet and my website with API calls

BSD 3-Clause License Copyright (c) 2020, Mike Bromberek All rights reserved. ProcessWorkout Exercise data is exported in JSON format to iCloud using

Wrappers around the most common maya.cmds and maya.api use cases

Maya FunctionSet (maya_fn) A package that decompose core maya.cmds and maya.api features to a set of simple functions. Tests The recommended approach

An unofficial python API for trading on the DeGiro platform, with the ability to get real time data and historical data.

DegiroAPI An unofficial API for the trading platform Degiro written in Python with the ability to get real time data and historical data for products.

This application demonstrates IoTVAS device discovery and security assessment API integration with the Rapid7 InsightVM.
This application demonstrates IoTVAS device discovery and security assessment API integration with the Rapid7 InsightVM.

Introduction This repository hosts a sample application that demonstrates integrating Firmalyzer's IoTVAS API with the Rapid7 InsightVM platform. This

Comments
  • User roles

    User roles

    • Admin: Same permissions as the previous regular user
    • Uploader: Can create new manga and chapters, but only edit those they have published themselves
    • User: Regular user with no special permission (besides logging out and updating its own user)
    opened by D34DPlayer 0
  • Possible pagination leak

    Possible pagination leak

    Right now for pagination the whole list of items is requested and only then counted and sorted.

    This could be fixed if Deta provided a way to sort and count the total directly form the db.

    In the meantime we can do the sorting after every request and keep the total in a variable. So that the list never gets above the requested limit.

    bug 
    opened by D34DPlayer 0
Releases(v1.5.0)
Owner
Monochrome
Monochrome's services
Monochrome
Team Curie is a group of people working together to achieve a common aim

Team Curie is a group of people working together to achieve a common aim. We are enthusiasts!.... We are setting the pace!.... We offer encouragement and motivation....And we believe TeamWork makes t

4 Aug 07, 2021
Ergonomic option parser on top of dataclasses, inspired by structopt.

oppapī Ergonomic option parser on top of dataclasses, inspired by structopt. Usage from typing import Optional from oppapi import from_args, oppapi @

yukinarit 4 Jul 19, 2022
PatZilla is a modular patent information research platform and data integration toolkit with a modern user interface and access to multiple data sources.

PatZilla is a modular patent information research platform and data integration toolkit with a modern user interface and access to multiple data sources.

IP Tools 68 Dec 14, 2022
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

Rony Lantip 307 Jan 07, 2023
UUID_ApiGenerator - This an API that will return a key-value pair of randomly generated UUID

This an API that will return a key-value pair of randomly generated UUID. Key will be a timestamp and value will be UUID. While the

1 Jan 28, 2022
Python Classes Without Boilerplate

attrs is the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka d

The attrs Cabal 4.6k Jan 02, 2023
easy_sbatch - Batch submitting Slurm jobs with script templates

easy_sbatch - Batch submitting Slurm jobs with script templates

Wei Shen 13 Oct 11, 2022
Generate a wordlist to fuzz amounts or any other numerical values.

Generate a wordlist to fuzz amounts or any other numerical values. Based on Common Security Issues in Financially-Oriented Web Applications.

Ivan Å incek 3 Oct 14, 2022
Web app for keeping track of buildings in danger of collapsing in the event of an earthquake

Bulina Roșie 🇷🇴 Un cutremur în București nu este o situație ipotetică. Este o certitudine că acest lucru se va întâmpla. În acest context, la mai bi

Code for Romania 27 Nov 29, 2022
This is a pretty basic but relatively nice looking Python Pomodoro Timer.

Python Pomodoro-Timer This is a pretty basic but relatively nice looking Pomodoro Timer. Currently its set to a very basic mode, but the funcationalit

EmmHarris 2 Oct 18, 2021
Coursework project for DIP class. The goal is to use vision to guide the Dashgo robot through two traffic cones in bright color.

Coursework project for DIP class. The goal is to use vision to guide the Dashgo robot through two traffic cones in bright color.

Yueqian Liu 3 Oct 24, 2022
Spartan implementation of H.O.T.T.

Down The Path I was walking down the line, Trying to find some peace of mind. Then I saw you, You were takin' it slow, And walkin' it one step at a ti

Trebor Huang 25 Aug 05, 2022
freeCodeCamp Scientific Computing with Python Project for Certification.

Time_Calculator_freeCodeCamp freeCodeCamp Scientific Computing with Python Project for Certification. Write a function named add_time that takes in tw

Rajdeep Mondal 1 Dec 23, 2021
The first Python 1v1.lol triggerbot working with colors !

1v1.lol TriggerBot Afin d'utiliser mon triggerbot, vous devez activer le plein écran sur 1v1.lol sur votre naviguateur (quelque-soit ce dernier). Vous

Venax 5 Jul 25, 2022
Python Project For Beginner

Basic-Vitrual-AI-Assistant Python Project For Beginner Hey There, I had manipulated Selenium WebDriver to make this assistant. I hope, It will be help

Maruf Billah 13 Dec 12, 2022
LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visualization exercises.

libreMind Meditation exercises What is it? LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visua

1 May 24, 2022
PyLaboratory 0 Feb 07, 2022
Random pass word generator made with python. PyQt5 module is used to design GUI.

Differences in this GUI program : Default titlebar removed Custom Minimize,Maximize and Close Buttons Drag & move window from any point Program work l

Dimuth De Zoysa 1 Jan 26, 2022
This repository contains the exercices for the robotics class at Supaero, 2022.

Supaero robotics, 2022 This repository contains the exercices for the robotics class at Supaero, 2022. The exercices are organized by notebook. Each n

Gepetto team, LAAS-CNRS 5 Aug 01, 2022
Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them.

Vaccine Validator Tool to validate domestic New Zealand vaccine passes Create a new virtual environment: python3 -m venv ./venv Activate virtual envi

2 Dec 06, 2021