diff --git a/dev Requirements/Architecture diagram.md b/dev Requirements/Architecture diagram.md new file mode 100644 index 0000000..50841b9 --- /dev/null +++ b/dev Requirements/Architecture diagram.md @@ -0,0 +1,415 @@ +# Architecture Diagrams for Plutus Playground Studio + +These diagrams illustrate the **core system architecture, services, and workflows** that implement the usability flow specification. + +Below are **clear architecture and workflow diagrams** you can include in your GitHub README or documentation to explain **Plutus Playground Studio** visually. +These diagrams are written in **Mermaid**, which GitHub renders automatically. + + +``` +Table of contents +│ +├── Introduction +├── Features +├── Architecture Diagram +├── Developer Workflow +├── Compilation Pipeline +├── AI Project Generation +├── Smart Contract Interaction +├── Deployment Pipeline +├── Development Modes +├── Project Structure +├── Roadmap +``` + +--- + + +# 1. System Architecture Diagram + +This diagram shows how **frontend, backend, compilers, and blockchain interact**. + +```mermaid +flowchart TB + +Developer[Developer] + +subgraph Browser IDE +Editor[Monaco Code Editor] +AI[AI Assistant] +ProjectManager[Project Manager] +Wallet[Coxy Wallet Integration] +end + +subgraph Backend Services +API[Node.js API Server] +Auth[Authentication Service] +ProjectDB[(Project Database)] +ArtifactDB[(Artifact Storage)] +end + +subgraph Compilation Workers +PlutusWorker[Plutus Compiler Worker] +AikenWorker[Aiken Compiler Worker] +HeliosWorker[Helios Compiler Worker] +OpShinWorker[OpShin Compiler Worker] +end + +subgraph Blockchain +Cardano[Cardano Network] +end + +Developer --> Editor +Editor --> API +AI --> API +ProjectManager --> API + +API --> ProjectDB +API --> ArtifactDB + +API --> PlutusWorker +API --> AikenWorker +API --> HeliosWorker +API --> OpShinWorker + +PlutusWorker --> ArtifactDB +AikenWorker --> ArtifactDB +HeliosWorker --> ArtifactDB +OpShinWorker --> ArtifactDB + +Wallet --> Cardano +API --> Cardano +``` + +--- + +# 2. Developer Workflow Diagram + +This explains **how developers use the platform step by step**. + +```mermaid +flowchart TD + +Start[Developer Opens IDE] + +Language[Select Smart Contract Language] + +Prompt[Enter AI Project Prompt] + +Generate[AI Generates Project Structure] + +Code[Write or Edit Smart Contract] + +Compile[Compile Contract] + +Test[Run Simulations & Tests] + +Debug[Debug Validator Execution] + +Integrate[Generate Off-Chain Logic] + +Frontend[Build Frontend UI] + +Deploy[Deploy to Cardano Network] + +Export[Export or Push to GitHub] + +Start --> Language +Language --> Prompt +Prompt --> Generate +Generate --> Code +Code --> Compile +Compile --> Test +Test --> Debug +Debug --> Integrate +Integrate --> Frontend +Frontend --> Deploy +Deploy --> Export +``` + +--- + +# 3. Compilation Pipeline Diagram + +This shows **how contracts are compiled internally**. + +```mermaid +flowchart LR + +Source[Smart Contract Source Code] + +Parser[Language Parser] + +IR[Intermediate Representation] + +Compiler[Language Compiler] + +UPLC[UPLC Script] + +CBOR[CBOR Artifact] + +Hash[Script Hash] + +Cost[Execution Cost Analysis] + +Source --> Parser +Parser --> IR +IR --> Compiler +Compiler --> UPLC +UPLC --> CBOR +CBOR --> Hash +UPLC --> Cost +``` + +--- + +# 4. AI Project Generation Flow + +This explains how **AI builds the entire project automatically**. + +```mermaid +flowchart TD + +Prompt[Developer Prompt] + +AIEngine[AI Generation Engine] + +Contracts[Generate On-Chain Contracts] + +OffChain[Generate Off-Chain Logic] + +Frontend[Generate Frontend UI] + +Backend[Generate Backend API] + +Tests[Generate Tests] + +Config[Generate Config Files] + +Project[Complete Project Workspace] + +Prompt --> AIEngine + +AIEngine --> Contracts +AIEngine --> OffChain +AIEngine --> Frontend +AIEngine --> Backend +AIEngine --> Tests +AIEngine --> Config + +Contracts --> Project +OffChain --> Project +Frontend --> Project +Backend --> Project +Tests --> Project +Config --> Project +``` + +--- + +# 5. Smart Contract Interaction Diagram + +This shows **how the frontend interacts with Cardano smart contracts**. + +```mermaid +sequenceDiagram + +participant User +participant Frontend +participant Wallet +participant Backend +participant Cardano + +User->>Frontend: Connect Wallet +Frontend->>Wallet: Request Connection +Wallet-->>Frontend: Wallet Connected + +User->>Frontend: Lock ADA + +Frontend->>Backend: Build Transaction +Backend->>Wallet: Request Signature +Wallet-->>Backend: Signed Transaction + +Backend->>Cardano: Submit Transaction + +Cardano-->>Frontend: Transaction Confirmation +``` + +--- + +# 6. Deployment Pipeline + +This explains how **dApps are deployed from the IDE**. + +```mermaid +flowchart LR + +Code[Project Source Code] + +Build[Compile Smart Contract] + +Artifacts[Generate Artifacts] + +Upload[Upload to Backend] + +Deploy[Deploy to Cardano Network] + +Host[Deploy Frontend] + +Live[dApp Live] + +Code --> Build +Build --> Artifacts +Artifacts --> Upload +Upload --> Deploy +Deploy --> Host +Host --> Live +``` + +--- + +# 7. Project Directory Structure Diagram + +```mermaid +flowchart TD + +ProjectRoot[Project Root] + +Contracts[contracts/] +Tests[tests/] +Offchain[offchain/] +Frontend[frontend/] +Backend[backend/] +Database[database/] +Config[config/] + +ProjectRoot --> Contracts +ProjectRoot --> Tests +ProjectRoot --> Offchain +ProjectRoot --> Frontend +ProjectRoot --> Backend +ProjectRoot --> Database +ProjectRoot --> Config +``` + +--- + +# 8. Development Modes Diagram + +```mermaid +flowchart TD + +Developer[Developer] + +Mode{Choose Development Mode} + +Wizard[Wizard-Based Builder] + +IDE[IDE Manual Coding] + +Builder[Coxy Plutus Builder] + +Marlowe[Marlowe Block Editor] + +Editor[Code Editor] + +Compile[Compile & Test] + +Developer --> Mode + +Mode --> Wizard +Mode --> IDE + +Wizard --> Builder +Wizard --> Marlowe + +IDE --> Editor + +Builder --> Compile +Marlowe --> Compile +Editor --> Compile +``` + +--- + +# 9. Platform Component Architecture + +```mermaid +flowchart TB + +subgraph Frontend +IDE[Web IDE] +Wallet[Coxy Wallet] +UI[User Interface] +end + +subgraph Backend +API[Node.js API] +Services[Microservices] +Auth[Auth Service] +end + +subgraph Workers +Compiler[Compiler Workers] +AI[AI Engine] +end + +subgraph Storage +DB[(PostgreSQL)] +Artifacts[(Artifacts Storage)] +end + +subgraph Blockchain +Cardano[Cardano Network] +end + +IDE --> API +UI --> API +Wallet --> Cardano + +API --> Services +API --> DB +API --> Artifacts + +Services --> Compiler +Services --> AI + +Compiler --> Artifacts +API --> Cardano +``` + +--- + +# 10. Full Platform Overview + +```mermaid +flowchart LR + +Dev[Developer] + +IDE[Plutus Playground Studio] + +AI[AI Assistant] + +Compiler[Smart Contract Compilers] + +Tests[Testing Framework] + +Deploy[Deployment System] + +Cardano[Cardano Blockchain] + +GitHub[GitHub Repository] + +Dev --> IDE +IDE --> AI +IDE --> Compiler +IDE --> Tests +Tests --> Deploy +Compiler --> Deploy +Deploy --> Cardano +IDE --> GitHub +``` + +--- + diff --git a/dev Requirements/Software description.md b/dev Requirements/Software description.md new file mode 100644 index 0000000..c236981 --- /dev/null +++ b/dev Requirements/Software description.md @@ -0,0 +1,712 @@ +# Coxy Plutus Playground + +### Developer Documentation & Project Specification + +An open development project to transform **Coxy Plutus Builder Studio (CPBS)** into a full **Plutus Smart Contract Playground**, similar to **Remix IDE** used in the Ethereum ecosystem. + +The playground will provide developers with a **web-based development environment** where they can write, edit, compile, and test **Plutus** smart contracts without installing complex local toolchains. + +Below is a **complete, clean, developer-focused README** integrating: + +* your **original README** +* the **improved Step 2** +* the **usability flow** +* architecture clarity +* developer-friendly structure + +It is written so it can be **pasted directly into GitHub** as your project README. + +--- + +# Plutus Playground Studio + +Plutus Playground Studio is a **multi-language smart contract development environment for the Cardano ecosystem**. + +The platform provides an **integrated development environment (IDE)** that allows developers to: + +* write smart contracts +* compile and test them +* integrate on-chain and off-chain logic +* deploy decentralized applications +* manage projects +* export source code repositories + +The goal is to provide a **browser-based development studio similar to modern cloud IDEs**, optimized specifically for **Cardano smart contract development**. + +--- + +# Table of Contents + +1. Introduction +2. Features +3. System Specifications +4. Development Requirements +5. Usability Flow Specification +6. Project Architecture +7. Compilation Pipeline +8. Developer Workflow +9. Deployment System +10. GitHub Integration +11. Project Phases +12. Future Enhancements + +--- + +# 1. Introduction + +Plutus Playground Studio simplifies the process of developing **Cardano smart contracts** by providing a **browser-based development environment**. + +Developers can: + +* create projects +* write smart contracts +* run simulations +* test applications +* deploy dApps +* manage repositories + +The platform supports multiple smart contract languages including: + +* Plutus (Haskell) +* Aiken +* Helios +* OpShin +* Scalus +* Marlowe + +--- + +# 2. Features + +## Multi-Language Smart Contract Support + +Developers can build contracts using multiple Cardano languages. + +Supported languages include: + +* Plutus (Haskell) +* Aiken +* Helios +* OpShin +* Scalus +* Marlowe + +--- + +## Integrated Code Editor + +The IDE provides a modern code editing environment including: + +* syntax highlighting +* code completion +* linting +* multi-file editing +* error highlighting +* project navigation + +The editor is built using **Monaco Editor**. + +--- + +## Smart Contract Compilation + +Contracts can be compiled into blockchain-ready artifacts. + +Compilation produces: + +* UPLC scripts +* CBOR artifacts +* script hashes +* execution cost reports +* size metrics + +--- + +## Testing Framework + +The system supports multiple testing approaches: + +* unit tests +* contract simulations +* property testing +* integration tests +* off-chain testing + +--- + +## AI-Assisted Development + +Developers receive AI support for: + +* code generation +* debugging assistance +* optimization suggestions +* documentation generation +* contract templates + +--- + +## Project Management + +The IDE supports development workspaces including: + +* project creation +* folder management +* script organization +* configuration files +* test directories + +--- + +## Deployment System + +Smart contracts can be deployed to Cardano networks: + +* Preview Testnet +* PreProd Testnet +* Mainnet + +--- + +## GitHub Integration + +Developers can: + +* push projects directly to GitHub +* export repositories +* download full source code + +--- + +# 3. System Specifications + +The platform consists of several core components. + +--- + +## Frontend + +The frontend provides the browser-based development environment. + +Technologies: + +* React +* Html/css +* Javascript +* Next.js +* TypeScript +* Monaco Editor +* vue.js + +Responsibilities: + +* code editing +* project navigation +* compilation requests +* debugging interface +* artifact visualization +* wallet interaction + +--- + +## Backend Services + +Backend services handle platform logic. + +Technologies: + +* Node.js +* TypeScript +* Haskell services +* Python services +* Mysql +* Sql-lite + +Responsibilities: + +* project management +* compilation requests +* artifact storage +* authentication +* execution tracing + +--- + +## Compilation Workers + +Dedicated workers compile smart contracts using language-specific toolchains. + +Examples: + +* Plutus compiler +* Aiken compiler +* Helios compiler +* OpShin compiler + +Workers generate deployable artifacts. + +--- + +## Data Storage + +The system stores: + +* projects +* source code +* compilation artifacts +* deployment logs +* user accounts + +Recommended database: + +* PostgreSQL + +--- + +# 4. Development Requirements + +To run the system locally developers must install the following tools. + +--- + +## Development Environment + +Required tools: + +* Node.js +* Docker +* Git +* PostgreSQL + +--- + +## Smart Contract Toolchains + +Developers must install: + +* Plutus toolchain +* Aiken CLI +* OpShin compiler +* Helios CLI + +--- + +## Frontend Dependencies + +Frontend development requires: + +* React +* Next.js +* Monaco Editor + +--- + +# 5. Usability Flow Specification + +The following workflow describes how developers interact with the platform. + +This section serves as a **functional specification for system implementation**. + +--- + +# Step 1 — Language Selection + +When starting a new project, the user selects a smart contract language. + +Examples: + +* Haskell Plutus +* Aiken +* Helios +* OpShin +* Marlowe + +The IDE automatically configures: + +* project template +* compiler toolchain +* language syntax highlighting +* code completion + +--- + +# Step 2 — AI Project Initialization and Environment Setup + +After selecting a language, the platform initializes a **full decentralized application workspace using AI-assisted project generation**. + +The developer provides a **prompt describing the desired application**. + +Example prompt: + +``` +Create a Cardano smart contract that locks ADA and allows the owner to unlock it later. +Use Plutus. +Generate on-chain code, off-chain logic, frontend interface, backend API, +unit tests, and integrate Coxy Wallet on the PreProd testnet. +``` + +The system generates a **complete project structure**. + +Example: + +``` +project/ + contracts/ + tests/ + offchain/ + frontend/ + backend/ + database/ + config/ +``` + +--- + +## Wallet Integration Requirement + +All generated projects support **Coxy Wallet**. + +Wallet functionality includes: + +* connection to Cardano **PreProd testnet** +* wallet authentication +* transaction signing +* smart contract interaction +* balance retrieval + +--- + +## GitHub Integration + +Developers may link a GitHub repository during project initialization. + +Supported features: + +* repository creation +* automatic commits +* version control +* source code export + +Example workflow: + +``` +git init +git remote add origin +git push origin main +``` + +--- + +## Example Contract Templates + +Developers can generate projects using predefined examples. + +Example: + +### Lock / Unlock Contract + +This contract locks ADA at a script address and allows the owner to unlock it. + +Generated components include: + +**On-chain** + +* validator script +* datum definitions +* redeemer definitions + +**Off-chain** + +* lock transaction builder +* unlock transaction builder + +**Frontend** + +* lock funds UI +* unlock funds UI + +**Backend** + +* transaction coordination service + +Additional templates include: + +* NFT minting contracts +* escrow contracts +* auction contracts +* staking contracts +* multi-signature wallets + +--- + +## Testing Framework + +All layers include automated tests. + +Testing categories: + +### On-chain tests + +* validator logic +* datum validation +* redeemer validation + +### Off-chain tests + +* transaction generation +* wallet interaction + +### Frontend tests + +* component tests +* UI interaction tests + +### Backend tests + +* API tests +* database integration tests + +--- + +## Template-Based Frontend Builder + +The platform includes a visual template system. + +Templates may include: + +* NFT marketplace UI +* DeFi dashboard +* staking dashboard +* DAO governance panel + +--- + +## Development Modes + +Developers can choose between two development approaches. + +### Wizard-Based Development + +Visual smart contract creation using tools such as: + +* Coxy Plutus Builder +* Marlowe block-based editor + +--- + +### IDE-Based Development + +Advanced users can write contracts manually. + +Workflow: + +``` +Editor → Compile → Test → Deploy +``` + +--- + +# Step 3 — Coding in the Editor + +Developers write contracts using: + +### Wizard-Based Contract Builder + +Visual smart contract generation tools. + +Examples: + +* Coxy Plutus Builder +* Marlowe contract editor + +--- + +### Manual Coding + +Direct coding in the IDE with: + +* syntax highlighting +* auto-completion +* formatting +* real-time error detection + +--- + +# Step 4 — Build / Compile + +Developers compile smart contracts using the IDE build system. + +Compilation produces: + +* UPLC script +* CBOR artifact +* script hash +* execution cost analysis + +Errors appear directly in the editor. + +--- + +# Step 5 — Debugging and Tracing + +Debugging tools include: + +* transaction simulation +* execution tracing +* validator debugging +* error inspection + +Developers can inspect: + +* execution logs +* validator failures +* memory usage + +--- + +# Step 6 — AI Assisted Development and Testing + +AI tools assist developers with: + +* code generation +* error fixing +* contract optimization +* documentation generation + +The system supports **Test Driven Development (TDD)**. + +--- + +# Step 7 — Off-Chain Code Generation + +The platform automatically generates off-chain interaction code. + +Examples: + +* transaction building +* wallet interactions +* contract calls + +Supported languages: + +* JavaScript +* TypeScript +* Haskell + +--- + +# Step 8 — On-Chain and Off-Chain Integration + +The system integrates both layers into a working decentralized application. + +Integration testing verifies: + +* correct contract invocation +* transaction execution +* expected outputs + +--- + +# Step 9 — Frontend Development + +Developers build user interfaces for interacting with contracts. + +Frontend capabilities include: + +* wallet connection +* contract interaction +* transaction history +* balance display + +--- + +# Step 10 — Server-Side Data Management + +Backend services manage: + +* user accounts +* contract metadata +* project storage +* deployment logs + +Backend technologies include: + +* Node.js +* Haskell services + +--- + +# Step 11 — Application Deployment + +The platform enables direct deployment of decentralized applications. + +Deployment includes: + +* frontend hosting +* smart contract integration +* backend service configuration + +Deployment targets: + +* Preview Testnet +* PreProd Testnet +* Mainnet + +--- + +# Step 12 — Source Code Export + +Developers can export projects in two ways. + +### GitHub Integration + +Push directly to GitHub. + +``` +git push origin main +``` + +--- + +### Project Download + +Download the entire project as a source code archive. + +--- + +# 6. Project Phases + +Development is organized into phases. + +Phase 1 +IDE foundation and editor integration + +Phase 2 +Smart contract compiler pipeline + +Phase 3 +Testing and debugging system + +Phase 4 +Off-chain integration + +Phase 5 +Deployment system + +Phase 6 +AI development tools + +--- + +# 7. Future Enhancements + +Planned features include: + +* collaborative editing +* plugin system +* contract template marketplace +* multi-user workspaces +* contract auditing tools +* AI code review + +---