Skip to content

Repository files navigation

LinkedGram

LinkedGram is a small Go social-domain project with posts, comments, profiles, follow relationships, news feeds, and file-backed persistence. The repository was reconstructed from a set of conflicting standalone translations into one buildable Go module.

Requirements

  • Go 1.22 or newer

Run

go run ./cmd/linkedgram

The demo creates a post, adds a comment, and renders a news feed. The reusable domain API lives in the root linkedgram package.

Test

go test ./...
go test -race -cover ./...
go vet ./...

CI runs formatting, vet, race-enabled tests, and coverage on every push and pull request.

Package Overview

  • post.go: post/comment validation, voting, and visibility
  • newsfeed.go: concurrent-safe feed add, lookup, removal, and filtering
  • profile.go: validated profiles and atomic JSON decoding
  • user.go: user identity, profiles, and bidirectional follow relationships
  • post_store.go: JSON Lines post persistence with strict decode errors and a 1 MiB maximum per record
  • credential_store.go: registration and authentication with bcrypt-hashed credentials and atomic file replacement
  • cmd/linkedgram: one executable demo entry point

Runtime data is intentionally excluded from Git. Sample post and credential formats are available in examples/.

PostStore accepts records up to MaxPostRecordBytes (1 MiB), including records larger than the 64 KiB default scanner limit. It rejects oversized records before opening a file for append, so a failed save cannot create or change the store. The tracked examples/posts.jsonl file is a valid post-store sample.

Credential files contain only versioned bcrypt hashes and are written with owner-only permissions. The reconstructed application deliberately rejects the legacy username:plaintext-password format; reset those passwords rather than importing or attempting to migrate reversible secrets.

User objects never receive, store, or compare passwords. Create domain users with NewUser(username) and keep registration and authentication exclusively in CredentialStore.Add and CredentialStore.Authenticate.

Legacy Sources

The original repository stored 32 conflicting Go files and one Java/JUnit test artifact together. They duplicated types and entry points, so the package could not compile. Byte-for-byte snapshots are preserved with .txt appended under legacy/original-source-archive/; the suffix intentionally keeps them out of the Go build graph and must not be removed. Unused GUI images, historical Python requirements, and IDE metadata are also preserved under legacy/.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages