Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atriskmedia/tractstack-concierge
Concierge API service for Tract Stack
https://github.com/atriskmedia/tractstack-concierge
Last synced: about 1 month ago
JSON representation
Concierge API service for Tract Stack
- Host: GitHub
- URL: https://github.com/atriskmedia/tractstack-concierge
- Owner: AtRiskMedia
- License: other
- Created: 2023-03-13T02:17:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-02T00:53:46.000Z (about 2 months ago)
- Last Synced: 2024-11-02T01:18:03.387Z (about 2 months ago)
- Language: PHP
- Homepage: https://tractstack.com
- Size: 689 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Concierge api service for Tract Stack by At Risk Media
_Intelligent no-code websites & landing pages that validate product-market-fit_
- Built using [Gatsby](https://gatsbyjs.com)
- By [At Risk Media](https://atriskmedia.com) with love and oodles of unicorn oomph!## Tract Stack | Concierge
PHP backend for Tract Stack
- connects to MySQL
- connects to Neo4J### Install
- be sure to create a .env file under ./api/common and include:
-- DB_HOST, DB_NAME, DB_USER, DB_PASSWORD
-- SECRET_KEY to match gatsby-starter-tractstack
-- SECRET_NEO4J## MySQL Tables
```
CREATE TABLE campaigns(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(40) NOT NULL,
merged VARCHAR(64)
);CREATE TABLE leads(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(40) NOT NULL,
email VARCHAR(20) NOT NULL UNIQUE,
passwordHash BINARY(16) NOT NULL,
contact_persona VARCHAR(20) NOT NULL,
shortBio VARCHAR(280),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
merged VARCHAR(64)
);CREATE TABLE corpus(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
object_name VARCHAR(48) NOT NULL,
object_id VARCHAR(36) NOT NULL UNIQUE,
object_type VARCHAR(40) NOT NULL,
merged VARCHAR(64)
);CREATE TABLE parents(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
object_id INT(11) unsigned,
parent_id INT(11) unsigned,
CONSTRAINT `fk_object_id` FOREIGN KEY (object_id) REFERENCES corpus (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_parent_id` FOREIGN KEY (parent_id) REFERENCES corpus (id) ON DELETE CASCADE ON UPDATE RESTRICT
);CREATE TABLE fingerprints(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
fingerprint VARCHAR(32) NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
merged VARCHAR(64),
lead_id INT(11) unsigned,
CONSTRAINT `fk_fingerprint_lead` FOREIGN KEY (lead_id) REFERENCES leads (id) ON DELETE CASCADE ON UPDATE RESTRICT
);CREATE TABLE visits(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
fingerprint_id INT(11) unsigned NOT NULL,
campaign_id INT(11) unsigned,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
utmSource VARCHAR(40),
utmMedium VARCHAR(40),
utmTerm VARCHAR(40),
utmContent VARCHAR(40),
httpReferrer VARCHAR(4096),
httpUserAgent VARCHAR(4096),
merged VARCHAR(64),
CONSTRAINT `fk_visit_campaign` FOREIGN KEY (campaign_id) REFERENCES campaigns (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_visit_fingerprint` FOREIGN KEY (fingerprint_id) REFERENCES fingerprints (id) ON DELETE CASCADE ON UPDATE RESTRICT
);CREATE TABLE tokens(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
fingerprint_id INT(11) unsigned NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
valid_until TIMESTAMP NOT NULL,
refreshToken BINARY(16) NOT NULL,
CONSTRAINT `fk_token_fingerprint` FOREIGN KEY (fingerprint_id) REFERENCES fingerprints (id) ON DELETE CASCADE ON UPDATE RESTRICT
);CREATE TABLE heldbeliefs(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
belief_id INT(11) unsigned NOT NULL,
fingerprint_id INT(11) unsigned NOT NULL,
object_type VARCHAR(40) NOT NULL DEFAULT 'Belief',
object VARCHAR(40),
verb ENUM ('STRONGLY_AGREES','AGREES','NEITHER_AGREES_NOR_DISAGREES','DISAGREES','STRONGLY_DISAGREES','INTERESTED','NOT_INTERESTED','BELIEVES_YES','BELIEVES_NO','BELIEVES_TRUE','BELIEVES_FALSE','IDENTIFY_AS') NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT `fk_belief_corpus` FOREIGN KEY (belief_id) REFERENCES corpus (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_belief_fingerprint` FOREIGN KEY (fingerprint_id) REFERENCES fingerprints (id) ON DELETE CASCADE ON UPDATE RESTRICT
);CREATE TABLE actions(
id INT(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
object_id INT(11) unsigned NOT NULL,
parent_id INT(11) unsigned,
fingerprint_id INT(11) unsigned NOT NULL,
visit_id INT(11) unsigned NOT NULL,
verb VARCHAR(40),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT `fk_actions_object_id` FOREIGN KEY (object_id) REFERENCES corpus (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_actions_parent_id` FOREIGN KEY (parent_id) REFERENCES corpus (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_action_fingerprint` FOREIGN KEY (fingerprint_id) REFERENCES fingerprints (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_action_visit` FOREIGN KEY (visit_id) REFERENCES visits (id) ON DELETE CASCADE ON UPDATE RESTRICT
);```
## neo4j cypher
- leads - node, w/ properties:
-- lead_id
-- first_name
-- last_name
-- company- fingerprints - node, w/ properties:
-- fingerprint_id- beliefs - node, w/ properties:
-- belief_id
-- name- visits - node, w/ properties:
-- visit_id
-- created_at- corpus - node, w/ properties:
-- id
-- slug
-- object_type## relationships:
- leads -> fingerprints ... has
- beliefs -> fingerprints ... held_by
- fingerprints -> visits ... has
- visits -> corpus ... has_read | has_glossedOver / ... has_answered | has_interacted | has_attempted
- corpus -> corpus ... contains
- corpus -> corpus ... points_to# note: v0.2.0 switched to VARCHAR(64) from INT(11) for neo4j merged id
# note: v0.3.0 switched to no httpOnly cookie and pass refreshToken in jwt payload