Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs version 2 #415

Merged
merged 6 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/docs/documentation/aiboilerplate.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
sidebar_label: CodeAssist (β)
---

# Introduction

Welcome to the Zango documentation!
***

### Overview

Zango is a web application development framework built upon Django, designed to accelerate the development of custom business apps.


The key tenets of Zango are:
- Leverage the stengths of Django, an already proven and battle tested web framework
- Make available the basics of business web apps as part of the framework
- Natively multi-tenant - Host multiple apps from a single deployment
- Security & Compliances are built in.
- Suite of essential packages to serve as the building blocks of Apps
- Use case packages to build the industry specific use cases
***
2 changes: 1 addition & 1 deletion docs/docs/documentation/async-tasks/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Async Tasks
# Overview

Async tasks allow you to execute pieces of code asynchronously, enabling non-blocking execution and improving the overall responsiveness and scalability of your application. These tasks can be triggered in two main ways: through direct invocation or by scheduling them to run at specified intervals.

Expand Down
14 changes: 14 additions & 0 deletions docs/docs/documentation/contributing/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview

Welcome! We're excited you're interested in contributing to Zango Framework. This guide provides a high-level overview of how you can get involved.

First-time contributor? Read the your first contribution guide.

Ways to Contribute

- Code: Submit bug fixes and new features
- Documentation: Improve docs and write tutorials
- Bug Reports: Submit detailed bug reports
- Feature Requests: Suggest new features
- Help Others: Answer questions in discussions

170 changes: 170 additions & 0 deletions docs/docs/documentation/contributing/setting-up-environment.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Setting up Zango locally

To start contributing to Zango, you will first need to install its local copy using the Python package manager, pip.

Please ensure you have Python and pip installed on your system. If you haven't installed them yet, you can find Python installation instructions here and pip installation instructions here.

Once Python and pip are installed, you can create virtual environment in which your cloned zango will be installed. Follow the below steps for complete setup:

1. Clone the forked zango repository
2. Create a new virtual environment inside a fresh directory (this virtual env will be used to setup a zango project using local copy of zango similar to django.)
3. Activate your virtual env and run the below command to install local copy of zango:
```
pip install -e path/to/your/zango_repo/backend
```

Congrats! You have successfully installed the local zango framework in you virtual environment. Now, lets move forward to the next section
where you will setup a project using the local copy of zango framework.


# Setting up a zango project

### PostgreSQL Database Setup
Run the below command in your terminal to create a postgres container

```
docker run -d \
--name <db_name> \
-p 5432:5432 \
-e POSTGRES_USER=<username>\
-e POSTGRES_PASSWORD=<password> \
-e POSTGRES_DB=<db_name> \
-v db:/var/lib/postgresql/data \
postgres:latest
```

ex:

```
docker run -d \
--name zango_postgres_db \
-p 5432:5432 \
-e POSTGRES_USER=zango_admin \
-e POSTGRES_PASSWORD=zangopass \
-e POSTGRES_DB=zango_db \
-v db:/var/lib/postgresql/data \
postgres:latest
```

### Redis Setup
Run the below command in your terminal to create a redis container
```
docker run --name <name> -d -p 6379:6379 redis
```
ex:

```
docker run --name zango_redis -d -p 6379:6379 redis
```

# Creating the test Project
Follow these steps to create your project's root folder, initialize the project, and configure the necessary settings:

1. Choose a Directory:
Navigate to the directory where you want to create your project's root folder. You can use your preferred file explorer or the command line to create and navigate to this directory.

2. Activate the virtual env:
Activate the virtual env in which you installed the local copy of zango in above steps. Then, you can use the zango start-project command to initiate the creation of a new test project. You can also replace "testproject" with your preferred test project name.

zango start-project "testproject"

3. Provide Database Credentials:
During the project setup, you'll be prompted to provide your PostgreSQL database credentials. These credentials include:

Database Name
Database Username
Database Password
Database Host
Database Port (default is usually 5432)
If the provided credentials are incorrect or if there are issues with the database connection, the setup process will throw errors and cancel the project creation. This is because Zango will create schemas and perform migrations during the project's creation.

4. Migrate Schemas and Create Public Tenant:
Upon successful database connection, the setup process will automatically migrate schemas and create a public tenant. This ensures that your project is ready to go with the necessary database structure.

5. Configure Default Platform User:
Next, you'll be asked to provide details for the default platform user. This user serves as the first administrator and will have access to App Panel, where you can begin creating apps. You'll need to provide the following information:

Platform User Email Address
Password
Password Confirmation
Once you've entered these details, the setup process will create the default platform user for your project.

6. Project Folder Structure and Boilerplate Code:
With all the necessary configurations in place, the setup process will proceed to create your project's folder structure and populate it with boilerplate code. You're now ready to start developing your business apps within the Zango platform.

Project Structure
project_name/ # Project root directory
├── manage.py # Django command-line utility for administrative tasks
└── project_name/ # Django project package
├── __init__.py
├── asgi.py # ASGI config for the project
├── settings.py # Project settings (database, static files, etc.)
├── urls_public.py # Public URL patterns
├── urls_tenant.py # Tenant-specific URL pattern
├── urls.py # Project-level URL patterns
└── wsgi.py # WSGI config for the project


Running the Development Server
Now that you've set up your project using Zango, the next step is to start the development server. This server allows you to access App Panel, where you can begin creating your business apps. Follow these steps to run the development server:

1. Navigate to Your Project Folder:
Open your terminal or command prompt and navigate to the directory where you created your project's root folder. You can use the cd (change directory) command to move to the project directory. For example:

cd path/to/your/project
Replace path/to/your/project with the actual path to your project folder.

2. Start the Development Server:
Once you're inside the project folder, you can start the development server using the following command:

python manage.py runserver
This command will initiate the development server, and you'll see output indicating that the server is running. By default, the server will be available at http://localhost:8000/.

Running the development server is a crucial step in your project setup, as it provides you with a local environment for app development and testing.

Perform the below steps from the root directory of the project:

Starting the celery worker

celery -A testproject worker -l INFO
Starting Celery beat

celery -A testproject beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler

### Creating task and syncing it
1. Navigate to the module or package where you need to create the task and create tasks.py
```
workspace
App_Name
module_name
tasks.py --> Task File
```

2. Add the task with @shared_task decorator
```
from celery import shared_task

@shared_task
def download_task(request_data):

print("request_data: ", request_data)
pat = Patient.objects.create(
name="Download oc"
)
```
3. Navigate to App Panel and under Tasks Table sync the tasks

4. Executing task programmatically
```
from zango.core.tasks import zango_task_executor
zango_task_executor.delay(request.tenant.name, "<task_name>", *args, **kwargs)

task_name can be taken from App Panel -> Tasks table
```
5. Example
```
from zango.core.tasks import zango_task_executor
zango_task_executor.delay(request.tenant.name, ""patient.tasks.export_table", {"test": "test_kwarg"})

task_name can be taken from App Panel -> Tasks table
```
2 changes: 1 addition & 1 deletion docs/docs/documentation/ddms/ddm-field-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Relational fields in Zango models are specialized field types imported from Zang
from zango.apps.dynamic_models.fields import ZForeignKey

class MyModel(DynamicModelBase):
related_model = ZOneToOneField(RelatedModel, null=True, blank=True, on_delete=models.CASCADE)
related_model = ZForeignKey(RelatedModel, on_delete=models.CASCADE)
```

3. **ManyToManyField**:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/documentation/ddms/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Models
# Overview

Zango Data Model is a powerful feature designed to meet the specific needs of multi-tenant systems. This innovative concept allows you to define different data models for each tenant within the same application, making Zango a versatile platform for building multi-tenant applications.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/documentation/deployment/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deployment
# Overview

## How to Deploy the apps?

Expand Down
73 changes: 73 additions & 0 deletions docs/docs/documentation/enterprise-readiness.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Enterprise Readiness in Zango


Zango is designed to enable enterprise readiness by default. If you intend to build robust and secure
business applications, Zango offers a suite of features out-of-the-box to meet stringent enterprise
requirements. We highlight Zango’s enterprise-ready capabilities and the mechanisms that ensure your
applications are secure, compliant, and production-ready.

----------
### Application Security
Zango prioritizes security as a first-class feature, providing robust mechanisms to safeguard your applications against common vulnerabilities and threats. Below are the core security features offered by default:
#### **1. Access Log**
- Tracks and logs all user access to the application, providing visibility into who accessed what and when.
- Facilitates monitoring and compliance auditing through the App Panel
#### **2. Audit Logs**
- Comprehensive logging of all application as well as framework objects
- Helps ensure accountability and traceability for every action.
- Easy access of the audit logs through the App Panel.
#### **3. Access Control**
- All views that you create in Zango are blocked by default, enforcing the principle of zero trust in your application.
- Access is explicitly granted through policies, reducing the risk of unauthorized access.
-
#### **4. Debug Mode Verification**
- Ensures `DEBUG = False` in production environments to prevent sensitive information leakage.
#### **5. IP Restriction**
- Restricts access to App Panel based on configured IP whitelists.
- Displays a list of allowed IPs for transparency.
#### **6. Account Lockout**
- Implements account lockout mechanisms after a configurable number of failed login attempts.
- Displays the lockout duration to inform administrators.
#### **7. Allowed Password Attempts**
- Sets a limit on failed login attempts to mitigate brute-force attacks.
#### **8. Password Policies**
- **Password Age:** Enforces maximum password age, prompting users to update passwords periodically.
- **Password Strength:** Mandates complex passwords with defined length and character requirements.
#### **9. HTTPS Enforcement**
- Ensures that HTTPS-only is enforced for all requests, securing data in transit.
#### **10. No Default Credentials**
- Validates that no default IDs or passwords are active in production environments.
#### **11. Concurrent Sessions Disabled**
- Prevents multiple concurrent sessions per user to mitigate session hijacking risks.
----------
### Web Application Security
#### **1. XSS Protection**
- Configures HTTP response headers (e.g., `X-XSS-Protection`) to mitigate cross-site scripting attacks.
#### **2. Content Security Policy (CSP)**
- Enforces CSP to prevent data injection attacks such as XSS by specifying trusted sources for scripts and other resources.
#### **3. SQL Injection Protection**
- Uses prepared statements and ORM protections to guard against SQL injection vulnerabilities.
#### **4. Clickjacking Protection**
- Implements `X-Frame-Options` headers to prevent clickjacking attacks.
#### **5. Secure Cookies**
- Sets secure and `HttpOnly` flags for cookies to prevent JavaScript access and ensure they are transmitted only over HTTPS.
----------
### API Security
#### **1. API Rate Limiting**
- Enforces rate-limiting on API endpoints to mitigate brute-force attacks and prevent denial-of-service (DoS) incidents.
#### **2. Data Encryption in Transit**
- Encrypts data in transit using TLS, ensuring secure communication between clients and servers.
#### **3. Security Headers Compliance**
- Includes essential HTTP headers such as:
- `Strict-Transport-Security`
- `X-Content-Type-Options`
- `Referrer-Policy`
#### **4. External Resource Control**
- Validates that only trusted and necessary external resources are allowed, minimizing exposure to supply chain attacks.
----------
### Audit and Monitoring
- **Comprehensive Audit Logging:** Captures critical user and system actions for compliance and forensic analysis.
- **Access Visibility:** Provides detailed insights into system access and activities.
- **Automated Alerts:** Future support for integrating alerts for suspicious activities.
----------
By adopting Zango, you empower your business with a framework that is built for secure, enterprise-grade applications.
22 changes: 22 additions & 0 deletions docs/docs/documentation/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
sidebar_label: Examples
---

# Introduction

Welcome to the Zango documentation!
***

### Overview

Zango is a web application development framework built upon Django, designed to accelerate the development of custom business apps.


The key tenets of Zango are:
- Leverage the stengths of Django, an already proven and battle tested web framework
- Make available the basics of business web apps as part of the framework
- Natively multi-tenant - Host multiple apps from a single deployment
- Security & Compliances are built in.
- Suite of essential packages to serve as the building blocks of Apps
- Use case packages to build the industry specific use cases
***
58 changes: 58 additions & 0 deletions docs/docs/documentation/framework-architecture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
sidebar_label: Framework Architecture
---

# Framework Architecture

Zango is a multi-tenant Django Framework enabling fast development and secure and cost effective hosting of business apps.


![Framework Architecture](/img/Architecture_Diagram.png)


Here's an overview of the key capabilities:

#### 1. Foundational Capabilities:
The underlying architecture is engineered to provide a robust and scalable foundation for application development and management.
The platform offers essential, reusable elements for any business application, including App Lifecycle Management,
[User Management](../core/user-management/overview) , [Role-Based Access Controls](../core/user-roles/overview),
and a Detailed [Permissions Framework](../core/permission-framework/overview), available off-the-shelf for
immediate use. Furthermore, rich industry focussed [package ecosystem](../core/packages-ecosystem/overview)
allows rapid development of bespoke apps.


#### 2. Unlimited Customizability:
The platform allows for unlimited customization, allowing for the creation of applications tailored to the specific
needs of the healthcare industry. The customization layer is well orchestrated within the platform and managed by
common compliance and [permissions framework](../core/permission-framework/overview), thereby ensuring that compliance of the app remains intact even with customization.


#### 3. Data Isolation and Privacy:
Emphasizing data security and privacy, the platform incorporates advanced [data isolation techniques](../core/modules/overview). This allows for
multiple tenants to operate independently within the same environment, ensuring data integrity and confidentiality.


#### 4. Advanced Access Control:
Access control is paramount, especially in sensitive sectors like healthcare. Our architecture includes an advanced
[policy](../core/permission-framework/policies/overview) and [permission framework](../core/permission-framework/permissions/overview) that meticulously governs access, ensuring compliance with stringent security standards.


#### 5. Dynamic Application Management:
The platform offers dynamic application management capabilities, allowing for real-time updates and modifications
without impacting the overall system. This feature ensures continuous operations, adapting quickly to changing requirements.


#### 6. Rapid Development Toolkit/ Packages Ecosystem:
To accelerate development cycles, the platform integrates a suite of reusable components and [packages](../../category/packages). These tools
enable rapid deployment of common functionalities, reducing the time-to-market for new features.


#### 7. Enhanced Security and Compliance:
The architecture includes a dedicated layer for security and compliance, ensuring that all operations adhere to
the highest standards required in healthcare. This layer safeguards sensitive patient data and aligns with regulatory
requirements.


#### 8. Designed for Interoperability:
Designed to interact effortlessly with external systems and APIs, the platform facilitates integrations with a
range of healthcare systems and third-party services, enhancing its utility and reach.
Loading