An open API service indexing awesome lists of open source software.

https://github.com/gerardgargan/soppro

SopPro is a full stack mobile app built with React Native and .NET Core. It is used for creating and managing Standard Operating Procedures (SOPs). It features AI-assisted SOP generation, version history, role-based access, offline support, PDF export, and analytics.
https://github.com/gerardgargan/soppro

dotnet-core entity-framework expo handlebars javascript react react-native redux-toolkit

Last synced: 6 months ago
JSON representation

SopPro is a full stack mobile app built with React Native and .NET Core. It is used for creating and managing Standard Operating Procedures (SOPs). It features AI-assisted SOP generation, version history, role-based access, offline support, PDF export, and analytics.

Awesome Lists containing this project

README

          

# SopPro - Standard Operating Procedure (SOP) Generator

## Overview

SopPro is a mobile application designed to streamline the creation and management of Standard Operating Procedures (SOPs). This app allows users to create, edit, review, and approve SOPs with step-by-step instructions, including text and images. The app supports version control, AI-based SOP generation, and approval workflows, making it a great solution for organisations to ensure standardisation and compliance across their operations and training.

![UI](https://github.com/user-attachments/assets/a889c771-d600-4e4d-aecb-2eaa104075b1)
![UI](https://github.com/user-attachments/assets/26bc1d1a-9ab5-42ab-b5cf-643db9d0cee1)

---

### Features

- **SOP Generation and Management**: Add, update, and delete SOPs and SOP steps with text and images.
- **Add important safety information**: Add hazards, risks and required Personal Protective Equipment to SOPs.
- **Export to PDF layouts**: Export SOPs to PDF in a template format with custom branding options.
- **AI-Based SOP Generation**: Automatically generate SOPs based on task description.
- **Media support**: Attach images to SOP steps to enhance clarity.
- **Review and Approval**: SOPs can be reviewed and approved by designated users.
- **Version History**: Track changes and revert to previous versions of SOPs. Each version has a status (Draft, In Review, Approved, Rejected).
- **Multi-Tenancy Support**: Manage SOPs across different organisational tenants. Invite users to add them to your organisation.
- **Role based access**: Manage roles of users to control which actions they can perform in the application.

### Image Storage

The app uses **Azure Blob Storage** for storing and retrieving images associated with SOP steps.

## Tech Stack

- **Frontend**:
- React
- React Native
- Expo & Expo Router
- Redux & Redux Toolkit
- **Backend**:
- .NET Core API
- Entity Framework Core
- Azure Blob Storage
- **Authentication**:
- JSON Web Tokens (JWT)
- .NET Identity framewrk

## Application Architecture

### Backend

| Folder | Description |
| ------------- | ------------------------------------------------------------------------------------------------------ |
| `UnitTests` | Automated unit tests for testing business logic |
| `Controllers` | API endpoints; handle HTTP requests and route them to the appropriate services |
| `Data` | Contains the database context and configuration for Entity Framework Core |
| `Filters` | Custom action filters and middleware (e.g. for exception handling) |
| `Migrations` | Database migrations generated by EF Core to manage schema changes |
| `Models` | Entity models representing database tables and data transfer objects (DTOs) used in API communication. |
| `Repository` | Implements the repository pattern to encapsulate data access logic and promote abstraction. |
| `Service` | Contains business logic and orchestrates between controllers, repositories, and other modules. |
| `Templates` | Predefined Handlebars templates for generating html for structured content (e.g. emails) |
| `Utility` | Helper classes and utility functions used across the application (e.g. validation). |

### SopPro Mobile App

| Folder | Description |
| ------------ | ------------------------------------------------------------------------- |
| `api` | Contains an instance of axios with custom configuration and interceptors. |
| `app` | Entry point and navigation setup, contains the main screens. |
| `assets` | Static files such as images, fonts, icons, and other media assets. |
| `components` | Reusable UI components like buttons, cards, inputs, modals, etc. |
| `constants` | App-wide constants such as UI colors and styles. |
| `hooks` | Custom React hooks. |
| `store` | Global state management setup with Redux & Redux Toolkit. |
| `util` | Utility/helper functions used across the app. |

## Installation

### Prerequisites

- Install [Node.js](https://nodejs.org/)
- Install [Expo CLI](https://docs.expo.dev/get-started/installation/)
- Install [Visual Studio Code](https://code.visualstudio.com/) for development or VS Code
- Install .NET 9 SDK [.NET 9 Download](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
- Set up an Azure Blob Storage account

### Running the App

1. Clone the repository:
```bash
git clone https://github.com/gerardgargan/SopPro.git
```
2. Install dependencies for the mobile app:
```bash
cd SopPro
npm install
```
3. Add a.env file in the SopPro folder with the ip address of your backend .NET API
```bash
EXPO_PUBLIC_API_URL=http://{apiURL}:5000/api
```
4. Run the expo app
```bash
npx expo start
```
5. In the Backend folder, create a file named appsettings.json, paste in the below JSON. Update the relevant values, and update the connection string to your SQL database, you will also need to update and provide values and tokens for Postmark (email) service, OpenAI and Azure Blob Storage.

```json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server={server},1433;Database={databaseName};User Id={userId};Password={passwordHere};Encrypt=False;MultipleActiveResultSets=true;TrustServerCertificate=True",
"AzureBlobStorage": "DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey={accountKey};EndpointSuffix=core.windows.net"
},
"ApplicationSettings": {
"BaseUrl": "http://{apiUrl}:5000",
"JwtSecret": "{Secret Key Goes Here}",
"JwtIssuer": "http://{apiUrl}:5000",
"JwtAudience": "SopPro",
"JwtInviteExpireHours": ,
"JwtAuthExpireDays": ,
"JwtAuthRefreshEpireDays": ,
"PostmarkFromEmail": "{addEmail}",
"PostmarkApiToken": "{addPostMarkToken}",
"AzureBlobStorageContainer": "{addContainer}"
},
"OpenAi": {
"Model": "{configureModel}",
"ApiKey": "{AddApiKey}"
}

}
```

6. Ensure your SQL server is running (via docker on Mac or via SQL server on windows)
For security reasons, the actual values used for appsettings in this project have been git ignored.
7. In the root of the Backend folder, run the following command to generate the database in SQL server
```bash
cd Backend
dotnet ef database update
```
8. Run the .NET API
```bash
cd Backend
dotnet run
```

## Running Automated Tests

1. Run the following command to run the unit tests

```bash
cd Backend
dotnet test
```