archsketch 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- archsketch-0.1.0/PKG-INFO +281 -0
- archsketch-0.1.0/README.md +251 -0
- archsketch-0.1.0/archsketch/__init__.py +3 -0
- archsketch-0.1.0/archsketch/detectors/__init__.py +27 -0
- archsketch-0.1.0/archsketch/detectors/docker_compose.py +193 -0
- archsketch-0.1.0/archsketch/detectors/dockerfile.py +115 -0
- archsketch-0.1.0/archsketch/detectors/env_files.py +121 -0
- archsketch-0.1.0/archsketch/detectors/gradle.py +122 -0
- archsketch-0.1.0/archsketch/detectors/kubernetes.py +127 -0
- archsketch-0.1.0/archsketch/detectors/nginx_conf.py +151 -0
- archsketch-0.1.0/archsketch/detectors/package_json.py +123 -0
- archsketch-0.1.0/archsketch/detectors/pom_xml.py +103 -0
- archsketch-0.1.0/archsketch/detectors/procfile.py +98 -0
- archsketch-0.1.0/archsketch/detectors/requirements_txt.py +145 -0
- archsketch-0.1.0/archsketch/detectors/terraform.py +97 -0
- archsketch-0.1.0/archsketch/inference/__init__.py +5 -0
- archsketch-0.1.0/archsketch/inference/engine.py +286 -0
- archsketch-0.1.0/archsketch/main.py +607 -0
- archsketch-0.1.0/archsketch/models.py +101 -0
- archsketch-0.1.0/archsketch/renderers/__init__.py +6 -0
- archsketch-0.1.0/archsketch/renderers/ascii_renderer.py +335 -0
- archsketch-0.1.0/archsketch/renderers/graphviz_renderer.py +127 -0
- archsketch-0.1.0/archsketch/renderers/mermaid_renderer.py +76 -0
- archsketch-0.1.0/archsketch/scanner.py +176 -0
- archsketch-0.1.0/archsketch/utils.py +17 -0
- archsketch-0.1.0/archsketch.egg-info/PKG-INFO +281 -0
- archsketch-0.1.0/archsketch.egg-info/SOURCES.txt +40 -0
- archsketch-0.1.0/archsketch.egg-info/dependency_links.txt +1 -0
- archsketch-0.1.0/archsketch.egg-info/entry_points.txt +2 -0
- archsketch-0.1.0/archsketch.egg-info/requires.txt +14 -0
- archsketch-0.1.0/archsketch.egg-info/top_level.txt +1 -0
- archsketch-0.1.0/pyproject.toml +56 -0
- archsketch-0.1.0/setup.cfg +4 -0
- archsketch-0.1.0/tests/test_detectors.py +311 -0
- archsketch-0.1.0/tests/test_gradle_detector.py +27 -0
- archsketch-0.1.0/tests/test_graphviz_renderer.py +86 -0
- archsketch-0.1.0/tests/test_inference.py +234 -0
- archsketch-0.1.0/tests/test_nginx_detector.py +135 -0
- archsketch-0.1.0/tests/test_pom_xml_detector.py +71 -0
- archsketch-0.1.0/tests/test_procfile_detector.py +24 -0
- archsketch-0.1.0/tests/test_renderers.py +167 -0
- archsketch-0.1.0/tests/test_scanner.py +89 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: archsketch
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool that scans a project and infers system architecture
|
|
5
|
+
Author: ArchSketch Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: architecture,cli,diagram,mermaid
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: typer>=0.9.0
|
|
20
|
+
Requires-Dist: rich>=13.0.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: networkx>=3.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
26
|
+
Provides-Extra: graphviz
|
|
27
|
+
Requires-Dist: graphviz>=0.20.0; extra == "graphviz"
|
|
28
|
+
Provides-Extra: diff
|
|
29
|
+
Requires-Dist: gitpython>=3.1.0; extra == "diff"
|
|
30
|
+
|
|
31
|
+
# ArchSketch
|
|
32
|
+
|
|
33
|
+
A Python CLI tool that scans any project directory and automatically infers its system architecture from common project files, then displays a beautiful ASCII diagram in your terminal.
|
|
34
|
+
|
|
35
|
+
**No configuration needed.** Just point it at a folder.
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Clone the repo
|
|
41
|
+
git clone https://github.com/yourusername/archsketch.git
|
|
42
|
+
cd archsketch
|
|
43
|
+
|
|
44
|
+
# Set up Python environment
|
|
45
|
+
python -m venv venv
|
|
46
|
+
|
|
47
|
+
# Activate (Windows)
|
|
48
|
+
venv\Scripts\activate
|
|
49
|
+
|
|
50
|
+
# Activate (macOS/Linux)
|
|
51
|
+
source venv/bin/activate
|
|
52
|
+
|
|
53
|
+
# Install
|
|
54
|
+
pip install -e .
|
|
55
|
+
|
|
56
|
+
# Run on any project!
|
|
57
|
+
archsketch analyze /path/to/your/project
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Example Output
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
ARCHITECTURE SKETCH
|
|
64
|
+
|
|
65
|
+
+--------------------------+
|
|
66
|
+
| >> Reverse Proxy |
|
|
67
|
+
| Nginx |
|
|
68
|
+
+--------------------------+
|
|
69
|
+
|
|
|
70
|
+
v
|
|
71
|
+
+--------------------------+
|
|
72
|
+
| ## Frontend |
|
|
73
|
+
| Next.js |
|
|
74
|
+
+--------------------------+
|
|
75
|
+
|
|
|
76
|
+
v
|
|
77
|
+
+--------------------------+
|
|
78
|
+
| @@ Backend |
|
|
79
|
+
| FastAPI |
|
|
80
|
+
+--------------------------+
|
|
81
|
+
| |
|
|
82
|
+
v v
|
|
83
|
+
+----------------+ +----------------+
|
|
84
|
+
| [] Database | | <> Cache |
|
|
85
|
+
| PostgreSQL | | Redis |
|
|
86
|
+
+----------------+ +----------------+
|
|
87
|
+
|
|
88
|
+
+------------------------ Legend -------------------------+
|
|
89
|
+
| ## Frontend | @@ Backend | [] Database | <> Cache | >> Proxy |
|
|
90
|
+
+---------------------------------------------------------+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Screenshots
|
|
94
|
+
### Terminal output (analyze)
|
|
95
|
+
<img width="1886" height="903" alt="image" src="https://github.com/user-attachments/assets/d3c7909b-f350-4a37-8786-cace590750ee" />
|
|
96
|
+
|
|
97
|
+
### Exported SVG
|
|
98
|
+
<img width="1917" height="1074" alt="image" src="https://github.com/user-attachments/assets/41fe360f-4b33-4e15-a96f-e86b3ce597bf" />
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
### Analyze any project
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
archsketch analyze . # Current directory
|
|
106
|
+
archsketch analyze /path/to/your/project # Any project folder
|
|
107
|
+
archsketch analyze ~/code/my-app # Home directory path
|
|
108
|
+
archsketch analyze . --compact # Diagram only, no detections table
|
|
109
|
+
archsketch analyze . --no-table # Same as --compact
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Export to Mermaid
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
archsketch export /path/to/project --format mermaid --output architecture.mmd
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Export to SVG (shareable image)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Requires: pip install graphviz AND Graphviz binaries (https://graphviz.org/download/)
|
|
122
|
+
archsketch export . --format graphviz --output architecture.svg
|
|
123
|
+
|
|
124
|
+
# Or export DOT file (no binary needed), then convert: dot -Tsvg architecture.dot -o architecture.svg
|
|
125
|
+
archsketch export . --format dot --output architecture.dot
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Generates:
|
|
129
|
+
|
|
130
|
+
```mermaid
|
|
131
|
+
graph TD
|
|
132
|
+
frontend[Frontend: Next.js]
|
|
133
|
+
backend[Backend: FastAPI]
|
|
134
|
+
database[Database: PostgreSQL]
|
|
135
|
+
cache[Cache: Redis]
|
|
136
|
+
|
|
137
|
+
frontend --> backend
|
|
138
|
+
backend --> database
|
|
139
|
+
backend --> cache
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### JSON output
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
archsketch analyze /path/to/project --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Show Mermaid in terminal
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
archsketch show /path/to/project
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Compare architecture between git refs (diff)
|
|
155
|
+
|
|
156
|
+
Requires: `pip install gitpython`
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
archsketch diff main feature-branch
|
|
160
|
+
archsketch diff HEAD~1 HEAD ./src
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Shows added/removed components and edges (e.g. `+ Cache: Redis`, `- Database: MySQL`).
|
|
164
|
+
|
|
165
|
+
### Explain in the diagram
|
|
166
|
+
|
|
167
|
+
- **ASCII**: Each node box shows a short "From: ..." source line when available.
|
|
168
|
+
- **Mermaid**: Comments in the `.mmd` file document which file each node came from.
|
|
169
|
+
- **JSON**: Each node has `sources` and `explanation` for CI/scripting.
|
|
170
|
+
|
|
171
|
+
### Stable JSON for CI
|
|
172
|
+
|
|
173
|
+
Export includes `$schema`, `version`, and consistent shape. Schema: `schema/architecture.json`.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
archsketch analyze . --output architecture.json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## What It Detects
|
|
180
|
+
|
|
181
|
+
ArchSketch reads these files to understand your stack:
|
|
182
|
+
|
|
183
|
+
| File | What it detects |
|
|
184
|
+
|------|----------------|
|
|
185
|
+
| `package.json` | React, Next.js, Vue, Express, NestJS, Prisma, Redis, Remix, Astro, Hono, Supabase |
|
|
186
|
+
| `requirements.txt` | FastAPI, Flask, Django, Celery, psycopg2, redis, Supabase |
|
|
187
|
+
| `pyproject.toml` | Same as requirements.txt |
|
|
188
|
+
| `pom.xml` | Spring Boot, PostgreSQL, Redis, Kafka, Micronaut, Quarkus |
|
|
189
|
+
| `build.gradle` / `build.gradle.kts` | Spring Boot, PostgreSQL, Redis (Gradle) |
|
|
190
|
+
| `docker-compose.yml` | PostgreSQL, MySQL, Redis, Nginx, RabbitMQ, custom services |
|
|
191
|
+
| `Dockerfile` | Base images (node, python, nginx) |
|
|
192
|
+
| `.env` | Database URLs, Redis URLs, service connections |
|
|
193
|
+
| `nginx.conf` | Nginx, upstream backends, SSL, WebSocket |
|
|
194
|
+
| `Procfile` | web/worker process types, Gunicorn, Celery, Next.js |
|
|
195
|
+
| `deployment.yaml`, `service.yaml`, `k8s/*.yaml` | Kubernetes Deployments, Services, Ingress, container images |
|
|
196
|
+
| `*.tf` | Terraform (AWS RDS, Lambda, SQS, GCP, Azure resources) |
|
|
197
|
+
|
|
198
|
+
## Detected Technologies
|
|
199
|
+
|
|
200
|
+
| Role | Technologies |
|
|
201
|
+
|------|-------------|
|
|
202
|
+
| **Frontend** | React, Next.js, Vue.js, Nuxt.js, Angular, Svelte, **Remix**, **Astro**, **SolidJS**, **Qwik**, Preact |
|
|
203
|
+
| **Backend** | Express, NestJS, FastAPI, Flask, Django, Fastify, **Hono**, **Elysia**, **Spring Boot** (pom.xml), Micronaut, Quarkus |
|
|
204
|
+
| **Database** | PostgreSQL, MySQL, MongoDB, SQLite, **Supabase** |
|
|
205
|
+
| **Cache** | Redis, Memcached |
|
|
206
|
+
| **Reverse Proxy** | Nginx, Traefik, Caddy |
|
|
207
|
+
| **Worker** | Celery, Bull, RQ |
|
|
208
|
+
| **Queue** | RabbitMQ, Kafka |
|
|
209
|
+
|
|
210
|
+
## How It Works
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
Your Project ArchSketch Pipeline Output
|
|
214
|
+
│ │ │
|
|
215
|
+
├─ package.json ──► │ │
|
|
216
|
+
├─ requirements.txt ──► │ 1. Scan files │
|
|
217
|
+
├─ docker-compose.yml ► │ 2. Detect technologies │ ──► ASCII Diagram
|
|
218
|
+
├─ Dockerfile ──► │ 3. Infer relationships │ ──► Mermaid Export
|
|
219
|
+
└─ .env ──► │ 4. Build graph │ ──► JSON Data
|
|
220
|
+
│ 5. Render │
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
1. **Scanner** - Walks your project, finds architecture-related files
|
|
224
|
+
2. **Detectors** - Parse each file type, extract technology signals
|
|
225
|
+
3. **Inference Engine** - Apply rules to determine roles and connections
|
|
226
|
+
4. **Renderer** - Output as ASCII art or Mermaid diagram
|
|
227
|
+
|
|
228
|
+
## Try It On Popular Projects
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Clone any open source project and analyze it
|
|
232
|
+
git clone https://github.com/tiangolo/full-stack-fastapi-template
|
|
233
|
+
archsketch analyze full-stack-fastapi-template
|
|
234
|
+
|
|
235
|
+
# Or your own projects
|
|
236
|
+
archsketch analyze ~/code/my-saas-app
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
### Run tests
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
pip install -e ".[dev]"
|
|
245
|
+
pytest
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Project structure
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
archsketch/
|
|
252
|
+
├── archsketch/
|
|
253
|
+
│ ├── main.py # CLI commands
|
|
254
|
+
│ ├── scanner.py # File discovery
|
|
255
|
+
│ ├── models.py # Data structures
|
|
256
|
+
│ ├── detectors/ # Technology detection
|
|
257
|
+
│ │ ├── package_json.py
|
|
258
|
+
│ │ ├── requirements_txt.py
|
|
259
|
+
│ │ ├── docker_compose.py
|
|
260
|
+
│ │ └── dockerfile.py
|
|
261
|
+
│ ├── inference/
|
|
262
|
+
│ │ └── engine.py # Architecture inference rules
|
|
263
|
+
│ └── renderers/
|
|
264
|
+
│ ├── ascii_renderer.py
|
|
265
|
+
│ └── mermaid_renderer.py
|
|
266
|
+
├── schema/
|
|
267
|
+
│ └── architecture.json # JSON schema for export (CI/scripting)
|
|
268
|
+
├── tests/ # 60+ tests
|
|
269
|
+
├── samples/ # Example projects
|
|
270
|
+
└── pyproject.toml
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Requirements
|
|
274
|
+
|
|
275
|
+
- Python 3.9+
|
|
276
|
+
- No external services needed
|
|
277
|
+
- Works offline
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
MIT
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# ArchSketch
|
|
2
|
+
|
|
3
|
+
A Python CLI tool that scans any project directory and automatically infers its system architecture from common project files, then displays a beautiful ASCII diagram in your terminal.
|
|
4
|
+
|
|
5
|
+
**No configuration needed.** Just point it at a folder.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Clone the repo
|
|
11
|
+
git clone https://github.com/yourusername/archsketch.git
|
|
12
|
+
cd archsketch
|
|
13
|
+
|
|
14
|
+
# Set up Python environment
|
|
15
|
+
python -m venv venv
|
|
16
|
+
|
|
17
|
+
# Activate (Windows)
|
|
18
|
+
venv\Scripts\activate
|
|
19
|
+
|
|
20
|
+
# Activate (macOS/Linux)
|
|
21
|
+
source venv/bin/activate
|
|
22
|
+
|
|
23
|
+
# Install
|
|
24
|
+
pip install -e .
|
|
25
|
+
|
|
26
|
+
# Run on any project!
|
|
27
|
+
archsketch analyze /path/to/your/project
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example Output
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
ARCHITECTURE SKETCH
|
|
34
|
+
|
|
35
|
+
+--------------------------+
|
|
36
|
+
| >> Reverse Proxy |
|
|
37
|
+
| Nginx |
|
|
38
|
+
+--------------------------+
|
|
39
|
+
|
|
|
40
|
+
v
|
|
41
|
+
+--------------------------+
|
|
42
|
+
| ## Frontend |
|
|
43
|
+
| Next.js |
|
|
44
|
+
+--------------------------+
|
|
45
|
+
|
|
|
46
|
+
v
|
|
47
|
+
+--------------------------+
|
|
48
|
+
| @@ Backend |
|
|
49
|
+
| FastAPI |
|
|
50
|
+
+--------------------------+
|
|
51
|
+
| |
|
|
52
|
+
v v
|
|
53
|
+
+----------------+ +----------------+
|
|
54
|
+
| [] Database | | <> Cache |
|
|
55
|
+
| PostgreSQL | | Redis |
|
|
56
|
+
+----------------+ +----------------+
|
|
57
|
+
|
|
58
|
+
+------------------------ Legend -------------------------+
|
|
59
|
+
| ## Frontend | @@ Backend | [] Database | <> Cache | >> Proxy |
|
|
60
|
+
+---------------------------------------------------------+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Screenshots
|
|
64
|
+
### Terminal output (analyze)
|
|
65
|
+
<img width="1886" height="903" alt="image" src="https://github.com/user-attachments/assets/d3c7909b-f350-4a37-8786-cace590750ee" />
|
|
66
|
+
|
|
67
|
+
### Exported SVG
|
|
68
|
+
<img width="1917" height="1074" alt="image" src="https://github.com/user-attachments/assets/41fe360f-4b33-4e15-a96f-e86b3ce597bf" />
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Analyze any project
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
archsketch analyze . # Current directory
|
|
76
|
+
archsketch analyze /path/to/your/project # Any project folder
|
|
77
|
+
archsketch analyze ~/code/my-app # Home directory path
|
|
78
|
+
archsketch analyze . --compact # Diagram only, no detections table
|
|
79
|
+
archsketch analyze . --no-table # Same as --compact
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Export to Mermaid
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
archsketch export /path/to/project --format mermaid --output architecture.mmd
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Export to SVG (shareable image)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Requires: pip install graphviz AND Graphviz binaries (https://graphviz.org/download/)
|
|
92
|
+
archsketch export . --format graphviz --output architecture.svg
|
|
93
|
+
|
|
94
|
+
# Or export DOT file (no binary needed), then convert: dot -Tsvg architecture.dot -o architecture.svg
|
|
95
|
+
archsketch export . --format dot --output architecture.dot
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Generates:
|
|
99
|
+
|
|
100
|
+
```mermaid
|
|
101
|
+
graph TD
|
|
102
|
+
frontend[Frontend: Next.js]
|
|
103
|
+
backend[Backend: FastAPI]
|
|
104
|
+
database[Database: PostgreSQL]
|
|
105
|
+
cache[Cache: Redis]
|
|
106
|
+
|
|
107
|
+
frontend --> backend
|
|
108
|
+
backend --> database
|
|
109
|
+
backend --> cache
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### JSON output
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
archsketch analyze /path/to/project --json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Show Mermaid in terminal
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
archsketch show /path/to/project
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Compare architecture between git refs (diff)
|
|
125
|
+
|
|
126
|
+
Requires: `pip install gitpython`
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
archsketch diff main feature-branch
|
|
130
|
+
archsketch diff HEAD~1 HEAD ./src
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Shows added/removed components and edges (e.g. `+ Cache: Redis`, `- Database: MySQL`).
|
|
134
|
+
|
|
135
|
+
### Explain in the diagram
|
|
136
|
+
|
|
137
|
+
- **ASCII**: Each node box shows a short "From: ..." source line when available.
|
|
138
|
+
- **Mermaid**: Comments in the `.mmd` file document which file each node came from.
|
|
139
|
+
- **JSON**: Each node has `sources` and `explanation` for CI/scripting.
|
|
140
|
+
|
|
141
|
+
### Stable JSON for CI
|
|
142
|
+
|
|
143
|
+
Export includes `$schema`, `version`, and consistent shape. Schema: `schema/architecture.json`.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
archsketch analyze . --output architecture.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## What It Detects
|
|
150
|
+
|
|
151
|
+
ArchSketch reads these files to understand your stack:
|
|
152
|
+
|
|
153
|
+
| File | What it detects |
|
|
154
|
+
|------|----------------|
|
|
155
|
+
| `package.json` | React, Next.js, Vue, Express, NestJS, Prisma, Redis, Remix, Astro, Hono, Supabase |
|
|
156
|
+
| `requirements.txt` | FastAPI, Flask, Django, Celery, psycopg2, redis, Supabase |
|
|
157
|
+
| `pyproject.toml` | Same as requirements.txt |
|
|
158
|
+
| `pom.xml` | Spring Boot, PostgreSQL, Redis, Kafka, Micronaut, Quarkus |
|
|
159
|
+
| `build.gradle` / `build.gradle.kts` | Spring Boot, PostgreSQL, Redis (Gradle) |
|
|
160
|
+
| `docker-compose.yml` | PostgreSQL, MySQL, Redis, Nginx, RabbitMQ, custom services |
|
|
161
|
+
| `Dockerfile` | Base images (node, python, nginx) |
|
|
162
|
+
| `.env` | Database URLs, Redis URLs, service connections |
|
|
163
|
+
| `nginx.conf` | Nginx, upstream backends, SSL, WebSocket |
|
|
164
|
+
| `Procfile` | web/worker process types, Gunicorn, Celery, Next.js |
|
|
165
|
+
| `deployment.yaml`, `service.yaml`, `k8s/*.yaml` | Kubernetes Deployments, Services, Ingress, container images |
|
|
166
|
+
| `*.tf` | Terraform (AWS RDS, Lambda, SQS, GCP, Azure resources) |
|
|
167
|
+
|
|
168
|
+
## Detected Technologies
|
|
169
|
+
|
|
170
|
+
| Role | Technologies |
|
|
171
|
+
|------|-------------|
|
|
172
|
+
| **Frontend** | React, Next.js, Vue.js, Nuxt.js, Angular, Svelte, **Remix**, **Astro**, **SolidJS**, **Qwik**, Preact |
|
|
173
|
+
| **Backend** | Express, NestJS, FastAPI, Flask, Django, Fastify, **Hono**, **Elysia**, **Spring Boot** (pom.xml), Micronaut, Quarkus |
|
|
174
|
+
| **Database** | PostgreSQL, MySQL, MongoDB, SQLite, **Supabase** |
|
|
175
|
+
| **Cache** | Redis, Memcached |
|
|
176
|
+
| **Reverse Proxy** | Nginx, Traefik, Caddy |
|
|
177
|
+
| **Worker** | Celery, Bull, RQ |
|
|
178
|
+
| **Queue** | RabbitMQ, Kafka |
|
|
179
|
+
|
|
180
|
+
## How It Works
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Your Project ArchSketch Pipeline Output
|
|
184
|
+
│ │ │
|
|
185
|
+
├─ package.json ──► │ │
|
|
186
|
+
├─ requirements.txt ──► │ 1. Scan files │
|
|
187
|
+
├─ docker-compose.yml ► │ 2. Detect technologies │ ──► ASCII Diagram
|
|
188
|
+
├─ Dockerfile ──► │ 3. Infer relationships │ ──► Mermaid Export
|
|
189
|
+
└─ .env ──► │ 4. Build graph │ ──► JSON Data
|
|
190
|
+
│ 5. Render │
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
1. **Scanner** - Walks your project, finds architecture-related files
|
|
194
|
+
2. **Detectors** - Parse each file type, extract technology signals
|
|
195
|
+
3. **Inference Engine** - Apply rules to determine roles and connections
|
|
196
|
+
4. **Renderer** - Output as ASCII art or Mermaid diagram
|
|
197
|
+
|
|
198
|
+
## Try It On Popular Projects
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Clone any open source project and analyze it
|
|
202
|
+
git clone https://github.com/tiangolo/full-stack-fastapi-template
|
|
203
|
+
archsketch analyze full-stack-fastapi-template
|
|
204
|
+
|
|
205
|
+
# Or your own projects
|
|
206
|
+
archsketch analyze ~/code/my-saas-app
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Development
|
|
210
|
+
|
|
211
|
+
### Run tests
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pip install -e ".[dev]"
|
|
215
|
+
pytest
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Project structure
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
archsketch/
|
|
222
|
+
├── archsketch/
|
|
223
|
+
│ ├── main.py # CLI commands
|
|
224
|
+
│ ├── scanner.py # File discovery
|
|
225
|
+
│ ├── models.py # Data structures
|
|
226
|
+
│ ├── detectors/ # Technology detection
|
|
227
|
+
│ │ ├── package_json.py
|
|
228
|
+
│ │ ├── requirements_txt.py
|
|
229
|
+
│ │ ├── docker_compose.py
|
|
230
|
+
│ │ └── dockerfile.py
|
|
231
|
+
│ ├── inference/
|
|
232
|
+
│ │ └── engine.py # Architecture inference rules
|
|
233
|
+
│ └── renderers/
|
|
234
|
+
│ ├── ascii_renderer.py
|
|
235
|
+
│ └── mermaid_renderer.py
|
|
236
|
+
├── schema/
|
|
237
|
+
│ └── architecture.json # JSON schema for export (CI/scripting)
|
|
238
|
+
├── tests/ # 60+ tests
|
|
239
|
+
├── samples/ # Example projects
|
|
240
|
+
└── pyproject.toml
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Requirements
|
|
244
|
+
|
|
245
|
+
- Python 3.9+
|
|
246
|
+
- No external services needed
|
|
247
|
+
- Works offline
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Technology detectors for various file types."""
|
|
2
|
+
|
|
3
|
+
from .package_json import detect_from_package_json
|
|
4
|
+
from .requirements_txt import detect_from_requirements
|
|
5
|
+
from .docker_compose import detect_from_docker_compose
|
|
6
|
+
from .dockerfile import detect_from_dockerfile
|
|
7
|
+
from .env_files import detect_from_env_files
|
|
8
|
+
from .nginx_conf import detect_from_nginx_conf
|
|
9
|
+
from .pom_xml import detect_from_pom_xml
|
|
10
|
+
from .gradle import detect_from_gradle
|
|
11
|
+
from .procfile import detect_from_procfile
|
|
12
|
+
from .kubernetes import detect_from_kubernetes
|
|
13
|
+
from .terraform import detect_from_terraform
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"detect_from_package_json",
|
|
17
|
+
"detect_from_requirements",
|
|
18
|
+
"detect_from_docker_compose",
|
|
19
|
+
"detect_from_dockerfile",
|
|
20
|
+
"detect_from_env_files",
|
|
21
|
+
"detect_from_nginx_conf",
|
|
22
|
+
"detect_from_pom_xml",
|
|
23
|
+
"detect_from_gradle",
|
|
24
|
+
"detect_from_procfile",
|
|
25
|
+
"detect_from_kubernetes",
|
|
26
|
+
"detect_from_terraform",
|
|
27
|
+
]
|