Skip to contents

{artcore} is the infrastructure foundation for the Artalytics platform. It provides database connectivity, CDN asset management, UUID generation, and environment validation that all other platform packages depend on.

Installation

# Install from GitHub (requires GITHUB_PAT)
pak::pkg_install("artalytics/artcore")

Quick Example

library(artcore)

# Validate environment before starting
check_env_dba()
check_env_cdn()

# Generate platform UUIDs for a new artwork
artist <- "88xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"  # existing artist
artwork <- gen_artwork_id()
# Returns: "99xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

# Upload authenticated artwork bundle to CDN
write_art_vault(artist, artwork, local_path = "path/to/bundle/")

# Verify upload succeeded
has_prefix("art-vault", paste0("uploads/", artist, "/", artwork))

# Connect to database for metadata storage
cn <- dbc()
# ... insert artwork record ...
dbd(cn)

Package Hierarchy

appPlatform / mod* packages (application layer)
        |
    artutils (data access layer)
        |
    artcore (infrastructure layer)  ← This package

{artcore} has no platform dependencies - it only depends on external packages ({DBI}, {RPostgres}, {paws.storage}). All other Artalytics packages depend on {artcore}.

Core Functionality

{artcore} provides four main categories of functions:

  • Database Operations — PostgreSQL connectivity with [dbc()] and [dbd()]
  • CDN Operations — DigitalOcean Spaces upload/download/delete helpers
  • UUID Generation — Platform-specific ID creation with prefix validation
  • Environment Validation — Configuration checks before package use

See the function reference for complete API documentation.

Environment Variables

Database Connection (Primary)

Required for [dbc()] to connect to the main platform database:

Variable Description
ART_PGHOST PostgreSQL host
ART_PGPORT PostgreSQL port
ART_PGUSER PostgreSQL username
ART_PGPASS PostgreSQL password
ART_PGDATA PostgreSQL database name

Database Connection (Marketing Site)

Required for dbc("artsite") to connect to the marketing database (leads, waitlist):

Variable Description
ART_PGHOST_SITE PostgreSQL host for marketing database
ART_PGPORT_SITE PostgreSQL port for marketing database
ART_PGUSER_SITE PostgreSQL username for marketing database
ART_PGPASS_SITE PostgreSQL password for marketing database
ART_PGDATA_SITE PostgreSQL database name for marketing database

CDN Access

Required for CDN operations (upload, download, delete):

Variable Description
ART_BUCKETS_KEY_ID DigitalOcean Spaces access key ID
ART_BUCKETS_KEY_SECRET DigitalOcean Spaces secret key

API Keys

Validated by [check_env_api()] when AI features are used:

Variable Description
ART_OPENAI_KEY OpenAI API key for AI features
ART_OPENSEA_KEY OpenSea API key for NFT integration
ART_RESEND_KEY Resend API key for email services
ART_GEMINI_KEY Google Gemini API key for AI features

Application Mode

Variable Description
ART_RUNAS_DEMO TRUE or FALSE — enables demo mode (disables writes)

Documentation

Development

For AI agent instructions and coding standards, see AGENTS.md.


Proprietary - Do Not Distribute