Skip to main content

Flask-Structure - Base Structure for API Projects 🧱

Licença PyPI

A Python library dedicated to exemplify and facilitate the start of Flask projects for APIs 💫. Download flask-structure and streamline the "start" of your projects with ease 🚀.

Repository with the idea of ​​the Library: Flask-Api-Structure

Organized and Scalable Structure. 😎📱

Project that can serve as a basis and learning to understand the structure

Structure

2024-03-09_17h53_25

Details

  • Controllers: Contains controllers that manage the application logic, connecting routes to specific operations.
  • Drivers: Stores the drivers and libraries necessary to connect and operate with other services or hardware.
  • Errors: Defines specific error types and custom exceptions that can be triggered during code execution.
  • Main: The main entry point of the application. Within this folder, "Routes" manages API routes, and "Server" is responsible for starting and managing the web server.
  • Models: Contains data models, usually classes representing tables in the database.
  • Static: Stores static files such as CSS, JS, images, etc., needed to render front-end web pages.
  • Templates: Maintains HTML templates and documentation related to the structure or usage of the API.
  • Validators: Includes scripts or modules to validate input data or API requests.
  • Views: Defines different types of HTTP responses and views associated with presentation logic.

API Structure Features 🔨

  • Info: Welcomes users and provides relevant information about the API and contacts.
  • Docs: A place to learn about the API and how to use it interactively and dynamically.
  • Favicon.ico: Icon to be displayed in the website window.

flask-stucture

Key Technologies Used 🌐

  • Flask: Framework used for web application development, providing a flexible and efficient structure for creating APIs and user interfaces.
  • Python: Primary programming language chosen for its versatility, simplicity, and large developer community.
  • Cerberus: Python data validation library, used to ensure the integrity and consistency of data manipulated by the application.
  • Other Libraries: The rest of the libraries can be found in requirements.txt, including various tools and utilities that complement and enhance the application's functionality.

Documentation 📃

API:

An API (Application Programming Interface) is a set of rules and definitions that allows communication between different software. It enables applications and services to exchange information and functionality efficiently and standardized.

Key Uses in Development:

  1. Service Integration: APIs facilitate integration between different services and platforms, allowing applications to share data and functionality.
  2. Mobile Application Development: APIs are essential for mobile app development, providing access to resources such as location, camera, notifications, among others.
  3. Access to External Data: Used to obtain data from external sources, such as social networks, databases, third-party services, providing up-to-date information.
  4. Integration with Web Platforms: APIs are crucial for integrating web applications, enabling efficient communication between the front-end and back-end.
  5. Microservices Development: In microservices architectures, APIs are essential for communication between the various distributed components of an application.
  6. Task Automation: APIs allow the automation of routine tasks, optimizing processes and improving operational efficiency.
  7. Plugin and Extension Development: Used to create plugins and extensions in various platforms, expanding the functionalities of existing software.
  8. Resource Economy: Facilitate development by allowing the reuse of already implemented functionalities, saving time and resources.

How to Run the Library Locally 🛠️

  1. Virtual Environment (Optional) For organization and ease of running the project, I suggest creating a virtual environment. To do this, use the following command:
  python -m venv .venv
  .venv\Scripts\activate
  1. Download the library:
   pip install flask-structure
  1. Run the command to create the project structure
  flask-structure create
  1. Install dependencies:
   pip install -r requirements.txt
  1. Run the application:
   python run.py
  1. Use the structure your way ;)

Demonstrated Features of the Generated Structure 💻

  1. Main Route ("/"): Returns a template that renders Swagger documentation.
    (http://127.0.0.1:3000)
2024-03-09_18h21_55
  1. API Information Route ("/info"): Returns a JSON with information about the API.
    (http://127.0.0.1:3000/info)
{
    "status": True,
    "message": "Welcome to the Structure Flask API!",
    "version": "1.0v",
    "endpoints": {
        "docs": "/",
        "info": "/info",
    },
    "documentation": "/",
    "contact": {
        "email_personal": "pedro.henrique.martins404@gmail.com",
        "email_academic": "pedro.borges@alu.unibalsas.edu.br",
        "github": "piedro404",
        "linkedin": "pedrohenrique404"
    }
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

About 📒

Thanks to everyone, I wish you great studies. If you want, contact me at pedro.henrique.martins404@gmail.com.

Metadata

Release files for flask-structure 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-structure 0.1.1
File Size Uploaded Provenance Actions
flask-structure-0.1.1.tar.gz 18.7 kB Without provenance Details for flask-structure-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flask-structure 0.1.1
File Interpreter ABI Platform Actions
flask_structure-0.1.1-py3-none-any.whl Python 3 none any Details for flask_structure-0.1.1-py3-none-any.whl

Total release size: 36.9 kB

Release files / flask-structure-0.1.1.tar.gz

Download URL flask-structure-0.1.1.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
81688f450fcb6378f63c99811e27da53e818ef8a1e2361b219b53a98b48eb89c
BLAKE2b-256 checksum
How to use checksums
b902e69cea191e9a65790a0c96bb1795939decbf86abcd10f155af396b063b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / flask_structure-0.1.1-py3-none-any.whl

Download URL flask_structure-0.1.1-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c1d655275f8b2729ea203b98b6458760c6adf9acc3ca1927ae80dbe15440866
BLAKE2b-256 checksum
How to use checksums
a7e4890a2f8546cbe77c86b5fa9e48f0b2d78a458ffc6c1debc72ac3797e7819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Security for flask-structure 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page