Skip to content

Commit 21d6702

Browse files
readme update + database structure
1 parent a368b7c commit 21d6702

3 files changed

Lines changed: 211 additions & 2 deletions

File tree

.datatable.sql

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
-- MySQL dump 10.13 Distrib 8.0.41, for Win64 (x86_64)
2+
--
3+
-- Host: 127.0.0.1 Database: jsonms_local
4+
-- ------------------------------------------------------
5+
-- Server version 8.0.41
6+
7+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10+
/*!50503 SET NAMES utf8mb4 */;
11+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12+
/*!40103 SET TIME_ZONE='+00:00' */;
13+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17+
18+
--
19+
-- Table structure for table `errors`
20+
--
21+
22+
DROP TABLE IF EXISTS `errors`;
23+
/*!40101 SET @saved_cs_client = @@character_set_client */;
24+
/*!50503 SET character_set_client = utf8mb4 */;
25+
CREATE TABLE `errors` (
26+
`id` int unsigned NOT NULL AUTO_INCREMENT,
27+
`key` varchar(255) NOT NULL,
28+
`message` text,
29+
`source` varchar(256) DEFAULT NULL,
30+
`line` smallint DEFAULT NULL,
31+
`column` smallint DEFAULT NULL,
32+
`stack` text,
33+
`occurred_on` datetime NOT NULL,
34+
`last_timestamp` bigint NOT NULL,
35+
`version` varchar(16) NOT NULL,
36+
`route` varchar(128) NOT NULL,
37+
`count` smallint NOT NULL DEFAULT '0',
38+
`user_agent` varchar(255) NOT NULL,
39+
`created_on` datetime DEFAULT (now()),
40+
`created_by` int unsigned NOT NULL,
41+
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
42+
PRIMARY KEY (`id`),
43+
UNIQUE KEY `errors_pk` (`key`)
44+
) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
45+
/*!40101 SET character_set_client = @saved_cs_client */;
46+
47+
--
48+
-- Table structure for table `history`
49+
--
50+
51+
DROP TABLE IF EXISTS `history`;
52+
/*!40101 SET @saved_cs_client = @@character_set_client */;
53+
/*!50503 SET character_set_client = utf8mb4 */;
54+
CREATE TABLE `history` (
55+
`id` int NOT NULL AUTO_INCREMENT,
56+
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
57+
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
58+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
59+
`created_by` int DEFAULT NULL,
60+
PRIMARY KEY (`id`),
61+
KEY `history_interfaces_uuid_fk` (`uuid`),
62+
KEY `history_users_id_fk` (`created_by`),
63+
CONSTRAINT `history_interfaces_uuid_fk` FOREIGN KEY (`uuid`) REFERENCES `structures` (`uuid`) ON DELETE CASCADE,
64+
CONSTRAINT `history_users_id_fk` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
65+
) ENGINE=InnoDB AUTO_INCREMENT=378 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
66+
/*!40101 SET character_set_client = @saved_cs_client */;
67+
68+
--
69+
-- Table structure for table `permissions`
70+
--
71+
72+
DROP TABLE IF EXISTS `permissions`;
73+
/*!40101 SET @saved_cs_client = @@character_set_client */;
74+
/*!50503 SET character_set_client = utf8mb4 */;
75+
CREATE TABLE `permissions` (
76+
`id` int NOT NULL AUTO_INCREMENT,
77+
`structure_uuid` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
78+
`type` enum('admin','interface') COLLATE utf8mb4_unicode_ci NOT NULL,
79+
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
80+
PRIMARY KEY (`id`)
81+
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
82+
/*!40101 SET character_set_client = @saved_cs_client */;
83+
84+
--
85+
-- Table structure for table `structures`
86+
--
87+
88+
DROP TABLE IF EXISTS `structures`;
89+
/*!40101 SET @saved_cs_client = @@character_set_client */;
90+
/*!50503 SET character_set_client = utf8mb4 */;
91+
CREATE TABLE `structures` (
92+
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT (uuid()),
93+
`hash` char(10) COLLATE utf8mb4_unicode_ci NOT NULL,
94+
`label` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
95+
`logo` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
96+
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
97+
`webhook` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
98+
`created_by` int NOT NULL,
99+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
100+
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
101+
PRIMARY KEY (`uuid`),
102+
KEY `interfaces_users_id_fk` (`created_by`),
103+
KEY `interfaces__hash_index` (`hash`),
104+
KEY `interfaces_webhooks_uuid_fk` (`webhook`),
105+
CONSTRAINT `interfaces_users_id_fk` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
106+
CONSTRAINT `interfaces_webhooks_uuid_fk` FOREIGN KEY (`webhook`) REFERENCES `webhooks` (`uuid`)
107+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
108+
/*!40101 SET character_set_client = @saved_cs_client */;
109+
110+
--
111+
-- Table structure for table `users`
112+
--
113+
114+
DROP TABLE IF EXISTS `users`;
115+
/*!40101 SET @saved_cs_client = @@character_set_client */;
116+
/*!50503 SET character_set_client = utf8mb4 */;
117+
CREATE TABLE `users` (
118+
`id` int NOT NULL AUTO_INCREMENT,
119+
`google_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
120+
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
121+
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
122+
`avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
123+
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
124+
PRIMARY KEY (`id`),
125+
UNIQUE KEY `google_id` (`google_id`)
126+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
127+
/*!40101 SET character_set_client = @saved_cs_client */;
128+
129+
--
130+
-- Table structure for table `webhooks`
131+
--
132+
133+
DROP TABLE IF EXISTS `webhooks`;
134+
/*!40101 SET @saved_cs_client = @@character_set_client */;
135+
/*!50503 SET character_set_client = utf8mb4 */;
136+
CREATE TABLE `webhooks` (
137+
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT (uuid()),
138+
`url` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
139+
`secret` varchar(84) COLLATE utf8mb4_unicode_ci NOT NULL,
140+
`cypher` varchar(84) COLLATE utf8mb4_unicode_ci NOT NULL,
141+
`created_by` int NOT NULL,
142+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
143+
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
144+
PRIMARY KEY (`uuid`),
145+
KEY `interfaces_webhooks_users_id_fk` (`created_by`),
146+
CONSTRAINT `interfaces_webhooks_users_id_fk` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
147+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
148+
/*!40101 SET character_set_client = @saved_cs_client */;
149+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
150+
151+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
152+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
153+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
154+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
155+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
156+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
157+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
158+
159+
-- Dump completed on 2025-04-26 18:13:45

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
# @jsonms/server
22

3-
The server to use with your instance of [jsonms-www](https://github.com/JSON-ms/www).
3+
Welcome to the **@jsonms/server** project!
4+
This package provides the server-side foundation for managing MySQL schemas and environment configurations for the JSONMS system.
5+
6+
## Requirements
7+
- PHP 8.x
8+
- MySQL server
9+
10+
## Getting Started
11+
12+
Follow these steps to set up and run the project locally:
13+
14+
### 1. Prepare the MySQL Database
15+
16+
A `.datatable.sql` file is included in the project.
17+
It contains the necessary schema definitions required to run the application.
18+
19+
To set up your database:
20+
21+
```bash
22+
mysql -u your_user -p your_database_name < .datatable.sql
23+
```
24+
25+
Replace your_user and your_database_name with your MySQL username and target database name.
26+
27+
Make sure your MySQL server is running and accessible.
28+
29+
### 2. Set Up Environment Variables
30+
The project uses environment variables for configuration.
31+
A sample file `.env.example` is provided.
32+
33+
To create your local `.env` file:
34+
35+
```bash
36+
cp .env.example .env
37+
```
38+
39+
Edit `.env` to match your environment settings, such as database connection credentials, ports, and other options.
40+
41+
### 3. Running the Server
42+
43+
You can define your own virtual host with Apache or Nginx but the fastest way to run the server is with a built-in PHP server.
44+
45+
```bash
46+
php -S localhost:9001 index.php
47+
```
48+
49+
## Contributing
50+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
51+
52+
## License
53+
This project is licensed under the BSD-3-Clause License. See the LICENSE file for details.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.11",
2+
"version": "1.0.12",
33
"name": "jsonms/server",
44
"description": "The JSON.ms Request Handler Server is a robust backend solution designed to manage and process all incoming requests from the main JSON.ms website.",
55
"license": "BSD-3-Clause",

0 commit comments

Comments
 (0)