Skip to content

Commit 41fc919

Browse files
committed
Merge branch 'main' of github.com:devforth/adminforth into next
2 parents 230b7f2 + 7dc653c commit 41fc919

32 files changed

Lines changed: 1735 additions & 458 deletions

File tree

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AdminForth - free powerfull Node.js admin panel framework on Vue & Tailwind
1+
# AdminForth - powerfull Agent-first Typescript admin panel framework
22

33

44
<a href="https://adminforth.dev"><img src="https://img.shields.io/badge/website-adminforth.dev-blue" style="height:24px"/></a> <a href="https://adminforth.dev"><img src="https://img.shields.io/npm/dw/adminforth" style="height:24px"/></a> <a href="https://devforth.io"><img src="https://raw.githubusercontent.com/devforth/OnLogs/e97944fffc24fec0ce2347b205c9bda3be8de5c5/.assets/df_powered_by.svg" style="height:28px"/></a>
@@ -16,9 +16,8 @@
1616
<br/>
1717

1818
<div align="center">
19-
<img src="https://github.com/user-attachments/assets/e643caad-1daa-4085-b125-cc940557a2ec"
20-
alt="AdminForth Dashboard" width="90%">
21-
19+
<img src="https://github.com/user-attachments/assets/775c527d-65c3-4d9c-bb0c-3692462f2818"
20+
alt="AdminForth Agent" width="90%">
2221
</div>
2322

2423

@@ -38,32 +37,43 @@ Why AdminForth:
3837

3938
## Project initialisation
4039

41-
```
42-
mkdir myadmin && cd myadmin
40+
To create an AdminForth project, run:
41+
42+
```bash
4343
npx adminforth create-app
4444
```
4545

46-
## Previews
46+
During the interactive initialization process, AdminForth will ask you to provide a local database URL.
4747

48-
<a href="https://adminforth.dev/docs/tutorial/Customization/customPages">Custom Dashboard</a>
49-
<br/>
50-
<img src="https://github.com/user-attachments/assets/aa899196-f7f3-4582-839c-2267f2e9e197" alt="AdminForth Dashboard demo" width="80%" />
48+
### Integrating AdminForth into your existing application
5149

52-
<a href="https://adminforth.dev/docs/tutorial/Plugins/chat-gpt">Text completion plugin (Copilot-style) using LLMs</a>
53-
<br/>
50+
If you want to build an admin panel for an existing project that already has a database with tables, you can provide the connection URL to your existing development database, such as a local or deployed one.
5451

55-
<img src="https://github.com/user-attachments/assets/cfa17cbd-3a53-4725-ab46-53c7c7666028" alt="AdminForth ChatGPT demo" width="80%" />
52+
After that, you may want to generate AdminForth resource files from your existing database tables:
5653

57-
<a href="https://adminforth.dev/docs/tutorial/Plugins/upload/#image-generation">Image Generation using image generation models</a>
58-
<br/>
59-
<img src="https://github.com/user-attachments/assets/b923e044-7e29-46ff-ab91-eeca5eee2b0a" alt="AdminForth DALE-E image generator demo" width="80%">
54+
```bash
55+
npx adminforth resource
56+
```
57+
58+
Resource files are needed for AdminForth to “know” about your tables and define how to work with them.
59+
60+
Use the command above every time you add new tables or change their schema.
61+
62+
### Starting from scratch
63+
64+
If you do not have a database yet, start an empty local database, for example PostgreSQL in Docker, and provide its URL to the AdminForth CLI.
65+
66+
If the adminforth CLI does not detect any tables, it will suggest adding Prisma as a migration tool. Prisma is not related to AdminForth, but it is one of the most convenient migration tools.
67+
68+
Please follow [getting started](https://adminforth.dev/docs/tutorial/gettingStarted/).
6069

70+
# For AdminForth developers
6171

62-
# For developers
72+
> Follow this section only if you want to make changes to the AdminForth framework or develop a plugin.
6373
64-
The most convenient way to add new features or fixes is using `dev-demo`. It imports the source code of the repository and plugins so you can edit them and see changes on the fly.
74+
The most convenient way to add new features or fixes is to use `dev-demo`. It imports the repository source code and plugins, so you can edit them and see changes on the fly.
6575

66-
# Requirements
76+
## Requirements
6777

6878
- **Node.js 20**
6979
- **Docker**

adminforth/dataConnectors/sqlite.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ class SQLiteConnector extends AdminForthBaseConnector implements IAdminForthData
101101
const [precision, scale] = baseType.match(/\d+/g);
102102
field.precision = parseInt(precision);
103103
field.scale = parseInt(scale);
104+
} else if (baseType == 'json' || baseType == 'jsonb') {
105+
field.type = AdminForthDataTypes.JSON;
106+
field._underlineType = baseType;
104107
} else if (baseType === 'decimal') {
105108
field.type = AdminForthDataTypes.DECIMAL;
106109
field._underlineType = 'decimal';
@@ -155,17 +158,14 @@ class SQLiteConnector extends AdminForthBaseConnector implements IAdminForthData
155158
} else if (field.type == AdminForthDataTypes.BOOLEAN) {
156159
return value === null ? null : !!value;
157160
} else if (field.type == AdminForthDataTypes.JSON) {
158-
if (field._underlineType == 'text' || field._underlineType == 'varchar') {
161+
if (typeof value === 'string') {
159162
try {
160163
return JSON.parse(value);
161164
} catch (e) {
162165
return {'error': `Failed to parse JSON: ${e.message}`}
163166
}
164-
} else {
165-
afLogger.warn(`AdminForth: JSON field is not a string/text but ${field._underlineType}, this is not supported yet`);
166167
}
167168
}
168-
169169
return value;
170170
}
171171

@@ -192,12 +192,10 @@ class SQLiteConnector extends AdminForthBaseConnector implements IAdminForthData
192192
} else if (field.type == AdminForthDataTypes.BOOLEAN) {
193193
return value === null ? null : (value ? 1 : 0);
194194
} else if (field.type == AdminForthDataTypes.JSON) {
195-
// check underline type is text or string
196-
if (field._underlineType == 'text' || field._underlineType == 'varchar') {
197-
return JSON.stringify(value);
198-
} else {
199-
afLogger.warn(`AdminForth: JSON field is not a string/text but ${field._underlineType}, this is not supported yet`);
195+
if (value === null || value === undefined) {
196+
return null;
200197
}
198+
return typeof value === 'string' ? value : JSON.stringify(value);
201199
}
202200

203201
return value;

adminforth/documentation/blog/2024-10-31-compose-ec2-deployment/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ resource "null_resource" "sync_files_and_run" {
210210
provisioner "local-exec" {
211211
# heredoc syntax
212212
command = <<-EOF
213+
set -eu
214+
213215
rsync -t -av \
214216
--delete \
215217
--exclude 'node_modules' \

adminforth/documentation/blog/2024-11-14-compose-ec2-deployment-ci/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ resource "null_resource" "sync_files_and_run" {
255255
# heredoc syntax
256256
# remove files that where deleted on the source
257257
command = <<-EOF
258+
set -eu
259+
258260
# -o StrictHostKeyChecking=no
259261
rsync -t -av -e "ssh -i ./.keys/id_rsa -o StrictHostKeyChecking=no" \
260262
--delete \

adminforth/documentation/blog/2025-02-19-compose-aws-ec2-ecr-terraform-github-actions/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ resource "null_resource" "sync_files_and_run" {
480480
481481
provisioner "local-exec" {
482482
command = <<-EOF
483+
set -eu
484+
483485
aws ecr get-login-password --region ${local.aws_region} --profile myaws | docker login --username AWS --password-stdin ${aws_ecr_repository.myadmin_repo.repository_url}
484486
485487
echo "Running build"

adminforth/documentation/blog/2025-02-19-compose-ec2-deployment-github-actions-registry/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ resource "null_resource" "wait_for_user_data" {
337337
resource "null_resource" "setup_registry" {
338338
provisioner "local-exec" {
339339
command = <<-EOF
340+
set -eu
341+
340342
echo "Generating secret for local registry"
341343
sha256sum ./.keys/id_rsa | cut -d ' ' -f1 | tr -d '\n' > ./.keys/registry.pure
342344
@@ -396,6 +398,7 @@ resource "null_resource" "sync_files_and_run" {
396398
397399
provisioner "local-exec" {
398400
command = <<-EOF
401+
set -eu
399402
400403
# map appserver.local to the instance (in CI we don't know the IP, so have to use this mapping)
401404
# so then in GA pipeline we will use

0 commit comments

Comments
 (0)