Complete guide to building with Neo4j DataAPI GraphQL, React, and TypeScript.
-
- Project overview
- Tech stack summary
- Quick links
- Feature list
-
TUTORIAL.md β Recommended for Learning!
- Comprehensive 8-chapter tutorial
- Step-by-step application building
- Detailed explanations of concepts
- GraphQL and graph database fundamentals
- Complete with code examples and styling
- Includes deployment guide
- Best for: Learning Neo4j GraphQL from scratch
-
QUICKSTART.md β‘ Quick Reference
- Condensed code reference
- All components in one place
- Minimal explanations
- Best for: Experienced developers who want working code fast
-
- Environment setup
- Neo4j Aura configuration
- DataAPI GraphQL setup
- Dependencies installation
-
- GraphQL query design patterns
- React Query best practices
- Component architecture
- Type safety guidelines
- Performance optimization
- Security practices
- Testing strategies
- Deployment tips
-
- Common issues and solutions
- Authentication problems
- CORS errors
- Schema mismatches
- Performance issues
- Debugging techniques
-
- Pagination (offset & cursor)
- Infinite scroll
- Optimistic updates
- Batch operations
- Advanced search & filtering
- Data import/export
-
- GraphQL schema overview
- Type definitions
- Field resolvers
- Relationship patterns
-
- Tailwind CSS setup
- Utility class reference
- Component styling patterns
- Responsive design
-
package.json- Complete dependencies list- More examples coming soon!
-
- Environment variable template
Recommended: Follow the Tutorial
- Read README.md for project overview
- Complete TUTORIAL.md chapters 1-8
- Chapter 1: Set Up Your Environment
- Chapter 2: Read Data from Neo4j
- Chapter 3: Create New Data
- Chapter 4: Update Existing Data
- Chapter 5: Delete Data
- Chapter 6: Manage Relationships
- Chapter 7: Search and Filter
- Chapter 8: Deploy Your Application
- Reference TROUBLESHOOTING.md when stuck
- Experiment with the working application
- Try the "Try It Yourself" challenges in each chapter
Recommended: Quick Start + Best Practices
- Read README.md for overview
- Follow QUICKSTART.md to build the app
- Review BEST_PRACTICES.md
- Implement proper error handling
- Add type safety with TypeScript
- Set up React Query DevTools
- Refer to TROUBLESHOOTING.md when needed
Recommended: Advanced Examples + Customization
- Skim QUICKSTART.md for patterns
- Study ADVANCED_EXAMPLES.md
- Implement pagination or infinite scroll
- Add optimistic updates
- Create batch operations
- Build advanced search features
- Optimize performance
- Customize for your use case
When to Use the Tutorial (TUTORIAL.md)
β
You're new to Neo4j or graph databases
β
You want to understand why things work
β
You prefer progressive learning with explanations
β
You want to see complete, working code for each step
β
You need help with deployment and production
Time investment: 2-4 hours to complete all chapters
When to Use the Quick Start (QUICKSTART.md)
β
You're already familiar with GraphQL and React
β
You want working code fast without explanations
β
You need a reference to copy-paste from
β
You prefer to figure things out as you go
β
You're adapting this code for your own project
Time investment: 30-60 minutes to get running
- Queries: Fetch data from Neo4j
- Mutations: Create, update, delete data
- Variables: Type-safe query parameters
- Fragments: Reusable field selections
- Filtering: WHERE clauses with operators
- useQuery: Fetch and cache data
- useMutation: Modify data
- Query Keys: Cache identification
- Invalidation: Refresh stale data
- Optimistic Updates: UI updates before server confirms
- Nodes: Movies, People entities
- Relationships: ACTED_IN, DIRECTED
- Connect/Disconnect: Relationship management
- Traversal: Following relationships in queries
- Filtering: Complex WHERE conditions
- Container Components: Data fetching
- Presentation Components: UI rendering
- Custom Hooks: Reusable logic
- Type Safety: TypeScript interfaces
| Technology | Version | Purpose |
|---|---|---|
| React | 18+ | UI framework |
| TypeScript | 5+ | Type safety |
| Vite | 5+ | Build tool |
| graphql-request | 6+ | GraphQL client |
| TanStack Query | 5+ | Data fetching & caching |
| Tailwind CSS | 3+ | Styling |
| Neo4j Aura | - | Graph database |
| DataAPI GraphQL | - | GraphQL API layer |
-
Define GraphQL Operations
// src/graphql/myFeature.ts export const MY_QUERY = gql`...`; export const MY_MUTATION = gql`...`;
-
Create TypeScript Types
// src/types/myFeature.ts export interface MyData { ... }
-
Build Custom Hook (optional)
// src/hooks/useMyFeature.ts export function useMyFeature() { ... }
-
Create Components
// src/components/MyFeature.tsx export function MyFeature() { ... }
-
Add to App
// src/App.tsx import { MyFeature } from './components/MyFeature';
- Check TROUBLESHOOTING.md for common issues
- Open React Query DevTools to inspect queries
- Check browser Network tab for GraphQL requests
- Verify environment variables are set correctly
- Test queries in GraphQL Playground
- Ask for help in Neo4j Community
- Review BEST_PRACTICES.md performance section
- Implement pagination for large datasets
- Use React Query's
staleTimeappropriately - Add prefetching for predictable navigation
- Monitor bundle size and code-split if needed
- Use React Query DevTools to identify slow queries
movie-manager/
βββ src/
β βββ components/ # React components
β β βββ MovieList.tsx
β β βββ MovieForm.tsx
β β βββ Search.tsx
β β βββ RelationshipManager.tsx
β β
β βββ graphql/ # GraphQL operations
β β βββ operations.ts
β β
β βββ lib/ # Utilities & config
β β βββ graphql-client.ts
β β
β βββ types/ # TypeScript types
β β βββ movie.ts
β β
β βββ hooks/ # Custom React hooks (optional)
β β βββ useMovies.ts
β β βββ useCreateMovie.ts
β β
β βββ App.tsx # Main application
β βββ App.css # Styles
β βββ main.tsx # Entry point
β
βββ .env # Environment variables (not in git)
βββ .env.example # Environment template
βββ package.json # Dependencies
βββ tsconfig.json # TypeScript config
βββ vite.config.ts # Vite config
βββ TUTORIAL.md # 8-chapter tutorial
βββ QUICKSTART.md # Quick reference
βββ README.md # Project overview
- Neo4j Aura
- DataAPI GraphQL Docs
- Neo4j Community Forum
- Neo4j Discord
- Neo4j GraphQL Library
- Neo4j GraphAcademy
This guide is a living document. Contributions welcome!
- Report issues or unclear sections
- Suggest improvements or additional examples
- Share your implementations
- Add new advanced patterns
- Improve error messages
- Enhance documentation
See CONTRIBUTING.md for guidelines.
# Create new project
npm create vite@latest my-app -- --template react-ts
# Install dependencies
npm install graphql-request graphql @tanstack/react-query
# Development
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview// GraphQL Client
import { GraphQLClient } from 'graphql-request';
import { gql } from 'graphql-request';
// React Query
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
// React
import { useState, useEffect } from 'react';// Query
const { data, isLoading, error } = useQuery({
queryKey: ['key'],
queryFn: () => graphqlClient.request(QUERY)
});
// Mutation
const mutation = useMutation({
mutationFn: (data) => graphqlClient.request(MUTATION, data),
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['key'] })
});
// Conditional Query
const { data } = useQuery({
queryKey: ['key', id],
queryFn: () => graphqlClient.request(QUERY, { id }),
enabled: !!id
});
// Relationship Connect
updateMovies(
where: { title: "Movie" }
connect: { actors: { where: { node: { name: "Actor" }}}}
)
// Relationship Disconnect
updateMovies(
where: { title: "Movie" }
disconnect: { actors: { where: { node: { name: "Actor" }}}}
)By completing this guide, you'll understand:
β
How to set up a React + TypeScript + GraphQL project
β
How to connect to Neo4j DataAPI GraphQL
β
How to perform CRUD operations on graph data
β
How to manage relationships in a graph database
β
How to implement search across connected data
β
How to use React Query for efficient data fetching
β
How to structure a maintainable React application
β
How to debug common issues
β
How to optimize performance
β
How to deploy to production
Stuck? Here's where to get help:
- Check the docs - Start with TROUBLESHOOTING.md
- Search examples - Look in ADVANCED_EXAMPLES.md
- Tutorial chapters - Review specific TUTORIAL.md chapters
- Community forum - Neo4j Community
- Discord - Neo4j Discord Server
- Stack Overflow - Tag questions with
neo4jandgraphql
MIT License - Feel free to use this guide for learning and building your own applications.
Ready to start building?
- New to Neo4j GraphQL? β Start with TUTORIAL.md
- Need quick reference? β Jump to QUICKSTART.md
- Want to contribute? β See CONTRIBUTING.md
- Join the community β Neo4j Discord
Happy coding! π